From: Steven G. Kargl Date: Mon, 18 May 2015 21:52:03 +0000 (+0000) Subject: re PR fortran/66043 (ICE on storage_size of null or output of null array) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ce7fb7118f9b9215a7a0320071fb0e956fec2dd6;p=gcc.git re PR fortran/66043 (ICE on storage_size of null or output of null array) 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. From-SVN: r223320 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1c66684ecbe..9da169462b7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66043 + * gfortran.dg/storage_size_6.f90: New tests. + 2015-05-18 Steven G. Kargl PR fortran/66040 diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 3e0ce5c8624..a6ba549f296 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -6243,6 +6243,15 @@ 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 ("Intrinsic function NULL at %L cannot be an actual " + "argument to STORAGE_SIZE, because it returns a " + "disassociated pointer", &a->where); + return false; + } + if (a->ts.type == BT_ASSUMED) { gfc_error ("%qs argument of %qs intrinsic at %L shall not be TYPE(*)", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 38f7ac1c2a8..bda83a50ed9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66043 + * gfortran.dg/storage_size_6.f90: New tests. + 2015-05-18 Steven G. Kargl PR fortran/66040 diff --git a/gcc/testsuite/gfortran.dg/storage_size_6.f90 b/gcc/testsuite/gfortran.dg/storage_size_6.f90 new file mode 100644 index 00000000000..503829231cc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/storage_size_6.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/66043 +! +! Original code from Gerhard Steinmetz +! +program p + print *, storage_size(null()) ! { dg-error "cannot be an actual" } +end