Commit e7303e85 by Francois-Xavier Coudert Committed by François-Xavier Coudert

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
parent c833f6d2
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> 2007-08-14 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/33073 PR fortran/33073
......
...@@ -5404,7 +5404,7 @@ gfc_get_type_attr_spec (symbol_attribute *attr) ...@@ -5404,7 +5404,7 @@ gfc_get_type_attr_spec (symbol_attribute *attr)
if (gfc_add_access (attr, ACCESS_PUBLIC, NULL, NULL) == FAILURE) if (gfc_add_access (attr, ACCESS_PUBLIC, NULL, NULL) == FAILURE)
return MATCH_ERROR; 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 /* If the type is defined to be bind(c) it then needs to make
sure that all fields are interoperable. This will sure that all fields are interoperable. This will
...@@ -5435,6 +5435,7 @@ gfc_match_derived_decl (void) ...@@ -5435,6 +5435,7 @@ gfc_match_derived_decl (void)
gfc_symbol *sym; gfc_symbol *sym;
match m; match m;
match is_type_attr_spec = MATCH_NO; match is_type_attr_spec = MATCH_NO;
bool seen_attr = false;
if (gfc_current_state () == COMP_DERIVED) if (gfc_current_state () == COMP_DERIVED)
return MATCH_NO; return MATCH_NO;
...@@ -5446,9 +5447,11 @@ gfc_match_derived_decl (void) ...@@ -5446,9 +5447,11 @@ gfc_match_derived_decl (void)
is_type_attr_spec = gfc_get_type_attr_spec (&attr); is_type_attr_spec = gfc_get_type_attr_spec (&attr);
if (is_type_attr_spec == MATCH_ERROR) if (is_type_attr_spec == MATCH_ERROR)
return MATCH_ERROR; return MATCH_ERROR;
if (is_type_attr_spec == MATCH_YES)
seen_attr = true;
} while (is_type_attr_spec == MATCH_YES); } 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"); gfc_error ("Expected :: in TYPE definition at %C");
return MATCH_ERROR; return MATCH_ERROR;
......
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> 2007-08-14 Paolo Carlini <pcarlini@suse.de>
PR c++/27211 PR c++/27211
...@@ -56,7 +56,7 @@ contains ...@@ -56,7 +56,7 @@ contains
end subroutine test1 end subroutine test1
subroutine test2() bind(c) subroutine test2() bind(c)
type, bind(c) f90type type, bind(c) :: f90type
integer(c_int) :: i integer(c_int) :: i
real(c_double) :: x real(c_double) :: x
end type f90type end type f90type
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment