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
This commit is contained in:
parent
a1ba31ced9
commit
1283ab121d
4 changed files with 37 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
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
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
10
gcc/testsuite/gfortran.dg/initialization_17.f90
Normal file
10
gcc/testsuite/gfortran.dg/initialization_17.f90
Normal file
|
@ -0,0 +1,10 @@
|
|||
! { 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
|
Loading…
Add table
Reference in a new issue