re PR fortran/41197 (ICE with ALLOCATE and nonscalar STAT= variable)
2009-09-07 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/41197 * resolve_c (resolve_allocate_deallocate): Complain if stat or errmsg varaible is an array. 2009-09-07 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/41197 * gfortran.dg/allocate_alloc_opt_1.f90: Use scalar variables for stat and errmsg. * gfortran.dg/deallocate_alloc_opt_1.f90: Likewise. * gfortran.dg/allocate_stat_2.f90: New test. From-SVN: r151480
This commit is contained in:
parent
8ff7f82415
commit
6c145259f5
6 changed files with 37 additions and 11 deletions
|
@ -1,3 +1,9 @@
|
|||
2009-09-07 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR fortran/41197
|
||||
* resolve_c (resolve_allocate_deallocate): Complain
|
||||
if stat or errmsg varaible is an array.
|
||||
|
||||
2009-09-05 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/41258
|
||||
|
|
|
@ -5732,9 +5732,10 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn)
|
|||
gfc_error ("Illegal stat-variable at %L for a PURE procedure",
|
||||
&stat->where);
|
||||
|
||||
if (stat->ts.type != BT_INTEGER
|
||||
&& !(stat->ref && (stat->ref->type == REF_ARRAY
|
||||
|| stat->ref->type == REF_COMPONENT)))
|
||||
if ((stat->ts.type != BT_INTEGER
|
||||
&& !(stat->ref && (stat->ref->type == REF_ARRAY
|
||||
|| stat->ref->type == REF_COMPONENT)))
|
||||
|| stat->rank > 0)
|
||||
gfc_error ("Stat-variable at %L must be a scalar INTEGER "
|
||||
"variable", &stat->where);
|
||||
|
||||
|
@ -5759,10 +5760,11 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn)
|
|||
gfc_error ("Illegal errmsg-variable at %L for a PURE procedure",
|
||||
&errmsg->where);
|
||||
|
||||
if (errmsg->ts.type != BT_CHARACTER
|
||||
&& !(errmsg->ref
|
||||
&& (errmsg->ref->type == REF_ARRAY
|
||||
|| errmsg->ref->type == REF_COMPONENT)))
|
||||
if ((errmsg->ts.type != BT_CHARACTER
|
||||
&& !(errmsg->ref
|
||||
&& (errmsg->ref->type == REF_ARRAY
|
||||
|| errmsg->ref->type == REF_COMPONENT)))
|
||||
|| errmsg->rank > 0 )
|
||||
gfc_error ("Errmsg-variable at %L must be a scalar CHARACTER "
|
||||
"variable", &errmsg->where);
|
||||
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2009-09-07 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR fortran/41197
|
||||
* gfortran.dg/allocate_alloc_opt_1.f90: Use scalar
|
||||
variables for stat and errmsg.
|
||||
* gfortran.dg/deallocate_alloc_opt_1.f90: Likewise.
|
||||
* gfortran.dg/allocate_stat_2.f90: New test.
|
||||
|
||||
2009-09-07 Bernd Schmidt <bernd.schmidt@analog.com>
|
||||
|
||||
* gcc.c-torture/compile/20090907-1.c: New test.
|
||||
|
|
|
@ -26,8 +26,8 @@ program a
|
|||
|
||||
allocate(err) ! { dg-error "nonprocedure pointer or an allocatable" }
|
||||
|
||||
allocate(error(2),stat=j,errmsg=error) ! { dg-error "shall not be ALLOCATEd within" }
|
||||
allocate(i(2), stat = i) ! { dg-error "shall not be ALLOCATEd within" }
|
||||
allocate(error(2),stat=j,errmsg=error(1)) ! { dg-error "shall not be ALLOCATEd within" }
|
||||
allocate(i(2), stat = i(1)) ! { dg-error "shall not be ALLOCATEd within" }
|
||||
|
||||
allocate(n) ! { dg-error "must be ALLOCATABLE or a POINTER" }
|
||||
|
||||
|
|
10
gcc/testsuite/gfortran.dg/allocate_stat_2.f90
Normal file
10
gcc/testsuite/gfortran.dg/allocate_stat_2.f90
Normal file
|
@ -0,0 +1,10 @@
|
|||
! { dg-do compile }
|
||||
! PR 41197
|
||||
program main
|
||||
integer, dimension (4) :: ier = 0
|
||||
character(len=30), dimension(2) :: er
|
||||
integer, dimension (:), allocatable :: a
|
||||
allocate (a (16), stat = ier) ! { dg-error "must be a scalar INTEGER" }
|
||||
allocate (a (14), stat=ier(1),errmsg=er) ! { dg-error "must be a scalar CHARACTER" }
|
||||
end
|
||||
|
|
@ -26,8 +26,8 @@ program a
|
|||
|
||||
deallocate(err) ! { dg-error "nonprocedure pointer or an allocatable" }
|
||||
|
||||
deallocate(error,stat=j,errmsg=error) ! { dg-error "shall not be DEALLOCATEd within" }
|
||||
deallocate(i, stat = i) ! { dg-error "shall not be DEALLOCATEd within" }
|
||||
deallocate(error,stat=j,errmsg=error(1)) ! { dg-error "shall not be DEALLOCATEd within" }
|
||||
deallocate(i, stat = i(1)) ! { dg-error "shall not be DEALLOCATEd within" }
|
||||
|
||||
deallocate(n) ! { dg-error "must be ALLOCATABLE or a POINTER" }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue