PR fortran/33066
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Aug 2007 23:26:23 +0000 (23:26 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Aug 2007 23:26:23 +0000 (23:26 +0000)
* decl.c (gfc_get_type_attr_spec): Fix whitespace.
(gfc_match_derived_decl): Fix logic.

* gfortran.dg/use_8.f90: New test.
* gfortran.dg/c_loc_tests_2.f03: Fix code.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127497 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/c_loc_tests_2.f03
gcc/testsuite/gfortran.dg/use_8.f90 [new file with mode: 0644]

index 7eef7f9..e43870d 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-15  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/33066
+       * decl.c (gfc_get_type_attr_spec): Fix whitespace.
+       (gfc_match_derived_decl): Fix logic.
+
 2007-08-14  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR fortran/33073
index 1bb82bc..8162300 100644 (file)
@@ -5404,7 +5404,7 @@ gfc_get_type_attr_spec (symbol_attribute *attr)
       if (gfc_add_access (attr, ACCESS_PUBLIC, NULL, NULL) == FAILURE)
        return MATCH_ERROR;
     }
-  else if(gfc_match(" , bind ( c )") == MATCH_YES)
+  else if (gfc_match(" , bind ( c )") == MATCH_YES)
     {
       /* If the type is defined to be bind(c) it then needs to make
         sure that all fields are interoperable.  This will
@@ -5435,6 +5435,7 @@ gfc_match_derived_decl (void)
   gfc_symbol *sym;
   match m;
   match is_type_attr_spec = MATCH_NO;
+  bool seen_attr = false;
 
   if (gfc_current_state () == COMP_DERIVED)
     return MATCH_NO;
@@ -5446,9 +5447,11 @@ gfc_match_derived_decl (void)
       is_type_attr_spec = gfc_get_type_attr_spec (&attr);
       if (is_type_attr_spec == MATCH_ERROR)
        return MATCH_ERROR;
+      if (is_type_attr_spec == MATCH_YES)
+       seen_attr = true;
     } while (is_type_attr_spec == MATCH_YES);
 
-  if (gfc_match (" ::") != MATCH_YES && attr.access != ACCESS_UNKNOWN)
+  if (gfc_match (" ::") != MATCH_YES && seen_attr)
     {
       gfc_error ("Expected :: in TYPE definition at %C");
       return MATCH_ERROR;
index 1baa094..08d33ac 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-15  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/33066
+       * gfortran.dg/use_8.f90: New test.
+       * gfortran.dg/c_loc_tests_2.f03: Fix code.
+
 2007-08-14  Paolo Carlini  <pcarlini@suse.de>
 
        PR c++/27211
index ae44495..4bdf395 100644 (file)
@@ -56,7 +56,7 @@ contains
   end subroutine test1
 
   subroutine test2() bind(c)
-    type, bind(c) f90type
+    type, bind(c) :: f90type
        integer(c_int) :: i
        real(c_double) :: x
     end type f90type
diff --git a/gcc/testsuite/gfortran.dg/use_8.f90 b/gcc/testsuite/gfortran.dg/use_8.f90
new file mode 100644 (file)
index 0000000..adb265e
--- /dev/null
@@ -0,0 +1,24 @@
+! { dg-do compile }
+module a
+
+  type, private, bind(C) b ! { dg-error "Expected :: in TYPE definition" }
+    integer i
+  end type b ! { dg-error "Expecting END MODULE statement" }
+
+  type, public c ! { dg-error "Expected :: in TYPE definition" }
+    integer j
+  end type c ! { dg-error "Expecting END MODULE statement" }
+
+  type, private d ! { dg-error "Expected :: in TYPE definition" }
+    integer k
+  end type b ! { dg-error "Expecting END MODULE statement" }
+
+  type, bind(C), public e ! { dg-error "Expected :: in TYPE definition" }
+    integer l
+  end type e ! { dg-error "Expecting END MODULE statement" }
+
+  type, bind(C) f ! { dg-error "Expected :: in TYPE definition" }
+    integer m
+  end type f ! { dg-error "Expecting END MODULE statement" }
+
+end module a