re PR fortran/33066 ("type, bind(C) t": Diagnose missing "::")

PR fortran/33066

	* 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.

From-SVN: r127497
This commit is contained in:
Francois-Xavier Coudert 2007-08-14 23:26:23 +00:00 committed by François-Xavier Coudert
parent c833f6d2b4
commit e7303e85ae
5 changed files with 42 additions and 3 deletions

View 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

View 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;

View 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

View 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

View file

@ -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