Commit 1283ab12 by Tobias Burnus Committed by Tobias Burnus

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
parent a1ba31ce
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 Daniel Franke <franke.daniel@gmail.com>
PR fortran/34533
......
......@@ -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
......
2007-12-25 Tobias Burnus <burnus@net-b.de>
PR fortran/34514
* gfortran.dg/initialization_17.f90: New.
2007-12-25 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/34566
! { dg-do compile }
!
! PR fortran/34514
!
! Initialization and typespec changes.
!
integer :: n = 5, m = 7
parameter (n = 42) ! { dg-error "Initializing already initialized variable" }
dimension :: m(3) ! { dg-error "after its initialisation" }
end
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