[Bug fortran/66043] ICE on storage_size of null or output of null array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66043 kargl at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |5.2 --- Comment #6 from kargl at gcc dot gnu.org --- Fixed on trunk and 5-branch. Thanks for the bug report.
[Bug fortran/66043] ICE on storage_size of null or output of null array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66043 --- Comment #5 from kargl at gcc dot gnu.org --- Author: kargl Date: Tue May 19 17:37:42 2015 New Revision: 223401 URL: https://gcc.gnu.org/viewcvs?rev=223401&root=gcc&view=rev Log: 2015-05-19 Steven G. Kargl PR fortran/66043 * check.c (gfc_check_storage_size): Prevent the direct use of NULL() in STORAGE_SIZE() reference. 2015-05-19 Steven G. Kargl PR fortran/66043 * gfortran.dg/storage_size_6.f90: New tests. Added: branches/gcc-5-branch/gcc/testsuite/gfortran.dg/storage_size_6.f90 Modified: branches/gcc-5-branch/gcc/fortran/ChangeLog branches/gcc-5-branch/gcc/fortran/check.c branches/gcc-5-branch/gcc/testsuite/ChangeLog
[Bug fortran/66043] ICE on storage_size of null or output of null array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66043 --- Comment #4 from kargl at gcc dot gnu.org --- Author: kargl Date: Mon May 18 21:52:03 2015 New Revision: 223320 URL: https://gcc.gnu.org/viewcvs?rev=223320&root=gcc&view=rev Log: 2015-05-18 Steven G. Kargl PR fortran/66043 * check.c (gfc_check_storage_size): Prevent the direct use of NULL() in STORAGE_SIZE() reference. 2015-05-18 Steven G. Kargl PR fortran/66043 * gfortran.dg/storage_size_6.f90: New tests. Added: trunk/gcc/testsuite/gfortran.dg/storage_size_6.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/check.c trunk/gcc/testsuite/ChangeLog
[Bug fortran/66043] ICE on storage_size of null or output of null array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66043 --- Comment #3 from Steve Kargl --- On Thu, May 07, 2015 at 05:39:44PM +, sgk at troutmask dot apl.washington.edu wrote: > > The above patch is good enough to catch the direct use > of NULL() in storage_size. The following should also > be rejected: > > program p >real, allocatable :: a >real, pointer :: b => null() >print *, storage_size(a)! unallocated allocatable >print *, storage_size(b)! disassociated pointer > end program p > > For 'b' we need to check > > a->symtree->n.sym->attr && > a->symtree->n->sym.value->expr_type = EXPR_NULL > Dang. Couldn't get gfc_check_storage_size to reject this one.
[Bug fortran/66043] ICE on storage_size of null or output of null array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66043 --- Comment #2 from Steve Kargl --- On Thu, May 07, 2015 at 03:52:24PM +, kargl at gcc dot gnu.org wrote: > > Index: check.c > === > --- check.c (revision 222869) > +++ check.c (working copy) > @@ -6243,6 +6243,16 @@ gfc_check_and (gfc_expr *i, gfc_expr *j) > bool > gfc_check_storage_size (gfc_expr *a, gfc_expr *kind) > { > + if (a->expr_type == EXPR_NULL) > +{ > + gfc_error ("%qs argument of %qs intrinsic at %L shall not be an " > +"unallocated allocatable variable or a disassociated or " > +"undefined pointer", > +gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic, > +&a->where); > + return false; > +} > + >if (a->ts.type == BT_ASSUMED) > { >gfc_error ("%qs argument of %qs intrinsic at %L shall not be TYPE(*)", > > The above patch is good enough to catch the direct use of NULL() in storage_size. The following should also be rejected: program p real, allocatable :: a real, pointer :: b => null() print *, storage_size(a)! unallocated allocatable print *, storage_size(b)! disassociated pointer end program p For 'b' we need to check a->symtree->n.sym->attr && a->symtree->n->sym.value->expr_type = EXPR_NULL For 'a', something similar is needed.
[Bug fortran/66043] ICE on storage_size of null or output of null array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66043 kargl at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2015-05-07 CC||kargl at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from kargl at gcc dot gnu.org --- Confirmned. In reviewing the draft of the F2008 standard, the argument of storage_size "shall not be an unallocated allocatable variable or a disassociated or undefined pointer." This suggests the following patch (watch cut-n-paste tab corruption): Index: check.c === --- check.c (revision 222869) +++ check.c (working copy) @@ -6243,6 +6243,16 @@ gfc_check_and (gfc_expr *i, gfc_expr *j) bool gfc_check_storage_size (gfc_expr *a, gfc_expr *kind) { + if (a->expr_type == EXPR_NULL) +{ + gfc_error ("%qs argument of %qs intrinsic at %L shall not be an " +"unallocated allocatable variable or a disassociated or " +"undefined pointer", +gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic, +&a->where); + return false; +} + if (a->ts.type == BT_ASSUMED) { gfc_error ("%qs argument of %qs intrinsic at %L shall not be TYPE(*)", This then yields % gfc6 -c po.f90 po.f90:2:28: print *, storage_size(null()) 1 Error: 'a' argument of 'storage_size' intrinsic at (1) shall not be an unallocated allocatable variable or a disassociated or undefined pointer