aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/decl.c7
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/c_loc_tests_2.f032
-rw-r--r--gcc/testsuite/gfortran.dg/use_8.f9024
5 files changed, 42 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7eef7f9..e43870d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 1bb82bc..8162300 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1baa094..08d33ac 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gfortran.dg/c_loc_tests_2.f03 b/gcc/testsuite/gfortran.dg/c_loc_tests_2.f03
index ae44495..4bdf395 100644
--- a/gcc/testsuite/gfortran.dg/c_loc_tests_2.f03
+++ b/gcc/testsuite/gfortran.dg/c_loc_tests_2.f03
@@ -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
index 0000000..adb265e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/use_8.f90
@@ -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