diff options
author | Janus Weil <jaydub66@gmail.com> | 2007-08-22 21:11:13 +0000 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2007-08-22 23:11:13 +0200 |
commit | 129d15a3e011dd6f48865673f70396a957c4deff (patch) | |
tree | 173c6a444df12265712ebd7e0ceddf0ff276c15c | |
parent | f11b235171696c8b04a850fa071a6d251b3cd533 (diff) | |
download | gcc-129d15a3e011dd6f48865673f70396a957c4deff.zip gcc-129d15a3e011dd6f48865673f70396a957c4deff.tar.gz gcc-129d15a3e011dd6f48865673f70396a957c4deff.tar.bz2 |
decl.c (match_attr_spec): Pass on errors from gfc_match_bind_c.
2007-08-22 Janus Weil <jaydub66@gmail.com>
* decl.c (match_attr_spec): Pass on errors from gfc_match_bind_c.
(gfc_match_bind_c): Bugfix in check for NAME= with abstract interfaces.
(gfc_match_mopdproc): Bugfix to reject module procedures in
abstract interfaces.
2007-08-22 Janus Weil <jaydub66@gmail.com>
* interface_abstract_1.f90: Extended test case.
* interface_abstract_3.f90: New test.
From-SVN: r127718
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/interface_abstract_1.f90 | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/interface_abstract_3.f90 | 11 |
5 files changed, 37 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 85e3903..346e811 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2007-08-22 Janus Weil <jaydub66@gmail.com> + + * decl.c (match_attr_spec): Pass on errors from gfc_match_bind_c. + (gfc_match_bind_c): Bugfix in check for NAME= with abstract interfaces. + (gfc_match_mopdproc): Bugfix to reject module procedures in + abstract interfaces. + 2007-08-22 Kai Tietz <kai.tietz@onevision.com> * f95-lang.c: (gfc_init_decl_processing): Choose sizetype by using diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index eb1e423..2a80841 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2549,8 +2549,11 @@ match_attr_spec (void) /* Chomp the comma. */ peek_char = gfc_next_char (); /* Try and match the bind(c). */ - if (gfc_match_bind_c (NULL) == MATCH_YES) + m = gfc_match_bind_c (NULL); + if (m == MATCH_YES) d = DECL_IS_BIND_C; + else if (m == MATCH_ERROR) + goto cleanup; } } @@ -4183,7 +4186,8 @@ gfc_match_bind_c (gfc_symbol *sym) strncpy (sym->binding_label, sym->name, strlen (sym->name) + 1); } - if (has_name_equals && current_interface.type == INTERFACE_ABSTRACT) + if (has_name_equals && gfc_current_state () == COMP_INTERFACE + && current_interface.type == INTERFACE_ABSTRACT) { gfc_error ("NAME not allowed on BIND(C) for ABSTRACT INTERFACE at %C"); return MATCH_ERROR; @@ -5327,7 +5331,8 @@ gfc_match_modproc (void) if (gfc_state_stack->state != COMP_INTERFACE || gfc_state_stack->previous == NULL - || current_interface.type == INTERFACE_NAMELESS) + || current_interface.type == INTERFACE_NAMELESS + || current_interface.type == INTERFACE_ABSTRACT) { gfc_error ("MODULE PROCEDURE at %C must be in a generic module " "interface"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6068fa9..cf9b7ed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-08-22 Janus Weil <jaydub66@gmail.com> + + * interface_abstract_1.f90: Extended test case. + * interface_abstract_3.f90: New test. + 2007-08-21 Christian Bruel <christian.bruel@st.com> * gcc.dg/fold-sub.c: New test. diff --git a/gcc/testsuite/gfortran.dg/interface_abstract_1.f90 b/gcc/testsuite/gfortran.dg/interface_abstract_1.f90 index afb3d6a..ab816bf 100644 --- a/gcc/testsuite/gfortran.dg/interface_abstract_1.f90 +++ b/gcc/testsuite/gfortran.dg/interface_abstract_1.f90 @@ -12,4 +12,10 @@ abstract interface subroutine real() ! { dg-error "cannot be the same as an intrinsic type" } end subroutine real end interface + +contains + + subroutine sub() bind(C,name="subC") + end subroutine + end diff --git a/gcc/testsuite/gfortran.dg/interface_abstract_3.f90 b/gcc/testsuite/gfortran.dg/interface_abstract_3.f90 new file mode 100644 index 0000000..3008d10 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_abstract_3.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! test for C1204 of Fortran 2003 standard: +! module procedure not allowed in abstract interface +module m + abstract interface + module procedure p ! { dg-error "must be in a generic module interface" } + end interface +contains + subroutine p() + end subroutine +end module m |