summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-02 13:20:52 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-02 13:20:52 +0000
commit7b8df29d95dd58f94e956c30866f5fac49bb98ea (patch)
tree42fef2e2fc714c9afea910f55f30df76ddd7dc91 /gcc/fortran
parent8957a593c1f2343e6d86ae8d7dd986d3a1476128 (diff)
downloadgcc-7b8df29d95dd58f94e956c30866f5fac49bb98ea.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184785 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/primary.c13
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 8f7822f6c4d..b2ed0066484 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 d1d96ffa68e..ae3a1f5778e 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;