diff options
author | Tobias Burnus <burnus@net-b.de> | 2012-03-02 14:20:52 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2012-03-02 14:20:52 +0100 |
commit | 6ee65df3f19d975ab2272531cc50c5dfc96bbf65 (patch) | |
tree | 42fef2e2fc714c9afea910f55f30df76ddd7dc91 /gcc | |
parent | f18075fff5c1b445f7e8c5d452f29195ef50118e (diff) | |
download | gcc-6ee65df3f19d975ab2272531cc50c5dfc96bbf65.zip gcc-6ee65df3f19d975ab2272531cc50c5dfc96bbf65.tar.gz gcc-6ee65df3f19d975ab2272531cc50c5dfc96bbf65.tar.bz2 |
re PR fortran/52325 (unclear error: Unclassifiable statement)
2012-03-02 Tobias Burnus <burnus@net-b.de>
PR fortran/52325
* primary.c (gfc_match_varspec): Add diagnostic for % with
nonderived types.
2012-03-02 Tobias Burnus <burnus@net-b.de>
PR fortran/52325
* gfortran.dg/derived_comp_array_ref_8.f90: New.
* gfortran.dg/nullify_2.f90: Update dg-error.
* gfortran.dg/nullify_4.f90: Ditto.
* gfortran.dg/pointer_init_6.f90: Ditto.
From-SVN: r184785
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/primary.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/derived_comp_array_ref_8.f90 | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/nullify_2.f90 | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/nullify_4.f90 | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pointer_init_6.f90 | 2 |
7 files changed, 38 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8f7822f..b2ed006 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,11 @@ 2012-03-02 Tobias Burnus <burnus@net-b.de> + PR fortran/52325 + * primary.c (gfc_match_varspec): Add diagnostic for % with + nonderived types. + +2012-03-02 Tobias Burnus <burnus@net-b.de> + PR fortran/52270 * expr.c (gfc_check_vardef_context): Fix check for intent-in polymorphic pointer . diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index d1d96ff..ae3a1f5 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -1910,6 +1910,19 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, && gfc_get_default_type (sym->name, sym->ns)->type == BT_DERIVED) gfc_set_default_type (sym, 0, sym->ns); + if (sym->ts.type == BT_UNKNOWN && gfc_match_char ('%') == MATCH_YES) + { + gfc_error ("Symbol '%s' at %C has no IMPLICIT type", sym->name); + return MATCH_ERROR; + } + else if ((sym->ts.type != BT_DERIVED && sym->ts.type != BT_CLASS) + && gfc_match_char ('%') == MATCH_YES) + { + gfc_error ("Unexpected '%%' for nonderived-type variable '%s' at %C", + sym->name) + return MATCH_ERROR; + } + if ((sym->ts.type != BT_DERIVED && sym->ts.type != BT_CLASS) || gfc_match_char ('%') != MATCH_YES) goto check_substring; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 19ea2d5..5138c36 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,13 @@ 2012-03-02 Tobias Burnus <burnus@net-b.de> + PR fortran/52325 + * gfortran.dg/derived_comp_array_ref_8.f90: New. + * gfortran.dg/nullify_2.f90: Update dg-error. + * gfortran.dg/nullify_4.f90: Ditto. + * gfortran.dg/pointer_init_6.f90: Ditto. + +2012-03-02 Tobias Burnus <burnus@net-b.de> + PR fortran/52270 * gfortran.dg/class_51.f90: New. diff --git a/gcc/testsuite/gfortran.dg/derived_comp_array_ref_8.f90 b/gcc/testsuite/gfortran.dg/derived_comp_array_ref_8.f90 new file mode 100644 index 0000000..739f4ad --- /dev/null +++ b/gcc/testsuite/gfortran.dg/derived_comp_array_ref_8.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! +! PR fortran/52325 +! +real :: f +cc%a = 5 ! { dg-error "Symbol 'cc' at .1. has no IMPLICIT type" } +f%a = 5 ! { dg-error "Unexpected '%' for nonderived-type variable 'f' at" } +end diff --git a/gcc/testsuite/gfortran.dg/nullify_2.f90 b/gcc/testsuite/gfortran.dg/nullify_2.f90 index ebfcb37..893ac24 100644 --- a/gcc/testsuite/gfortran.dg/nullify_2.f90 +++ b/gcc/testsuite/gfortran.dg/nullify_2.f90 @@ -3,5 +3,5 @@ program i implicit none TYPE (a) t1 ! { dg-error "is being used before" } - nullify(t1%x) ! { dg-error "error in NULLIFY" } + nullify(t1%x) ! { dg-error "Symbol 't1' at .1. has no IMPLICIT type" } end program diff --git a/gcc/testsuite/gfortran.dg/nullify_4.f90 b/gcc/testsuite/gfortran.dg/nullify_4.f90 index 48dcf72..0fd5056 100644 --- a/gcc/testsuite/gfortran.dg/nullify_4.f90 +++ b/gcc/testsuite/gfortran.dg/nullify_4.f90 @@ -4,5 +4,5 @@ ! Check error recovery; was crashing before. ! real, pointer :: ptr -nullify(ptr, mesh%coarser) ! { dg-error "Syntax error in NULLIFY statement" } +nullify(ptr, mesh%coarser) ! { dg-error "Symbol 'mesh' at .1. has no IMPLICIT type" } end diff --git a/gcc/testsuite/gfortran.dg/pointer_init_6.f90 b/gcc/testsuite/gfortran.dg/pointer_init_6.f90 index 92cece3..cc5cf36 100644 --- a/gcc/testsuite/gfortran.dg/pointer_init_6.f90 +++ b/gcc/testsuite/gfortran.dg/pointer_init_6.f90 @@ -27,7 +27,7 @@ module m2 type(t) :: x procedure(s), pointer :: pp1 => s procedure(s), pointer :: pp2 => pp1 ! { dg-error "may not be a procedure pointer" } - procedure(s), pointer :: pp3 => t%ppc ! { dg-error "Syntax error" } + procedure(s), pointer :: pp3 => t%ppc ! { dg-error "Symbol 't' at .1. has no IMPLICIT type" } contains |