diff options
author | Tobias Burnus <burnus@net-b.de> | 2007-12-25 13:05:23 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2007-12-25 13:05:23 +0100 |
commit | 1283ab121d8d5ef620e27fcdf4349321dbb0352f (patch) | |
tree | 73f43fe114afe6c19e945f51a0f1c8317bb62669 /gcc/fortran/decl.c | |
parent | a1ba31ced9af40c3ac37a968870e0363f7ae08ca (diff) | |
download | gcc-1283ab121d8d5ef620e27fcdf4349321dbb0352f.zip gcc-1283ab121d8d5ef620e27fcdf4349321dbb0352f.tar.gz gcc-1283ab121d8d5ef620e27fcdf4349321dbb0352f.tar.bz2 |
re PR fortran/34514 (Accepts invalid: Dimensions specified for N after initialisation)
2007-12-25 Tobias Burnus <burnus@net-b.de>
PR fortran/34514
* decl.c (attr_decl1): Reject specifying the DIMENSION for
already initialized variable.
(do_parm): Reject PARAMETER for already initialized variable.
2007-12-25 Tobias Burnus <burnus@net-b.de>
PR fortran/34514
* gfortran.dg/initialization_17.f90: New.
From-SVN: r131169
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 072477e..dd8eb35 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -5151,6 +5151,14 @@ attr_decl1 (void) goto cleanup; } + if (current_attr.dimension && sym->value) + { + gfc_error ("Dimensions specified for %s at %L after its " + "initialisation", sym->name, &var_locus); + m = MATCH_ERROR; + goto cleanup; + } + if ((current_attr.allocatable || current_attr.pointer) && (m == MATCH_YES) && (as->type != AS_DEFERRED)) { @@ -5753,6 +5761,13 @@ do_parm (void) goto cleanup; } + if (sym->value) + { + gfc_error ("Initializing already initialized variable at %C"); + m = MATCH_ERROR; + goto cleanup; + } + if (sym->ts.type == BT_CHARACTER && sym->ts.cl != NULL && sym->ts.cl->length != NULL |