From 3262dde64c162a520fbe8bae6bd4372411f6a790 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Sun, 29 Sep 2019 19:12:08 +0000 Subject: [PATCH] re PR fortran/91641 (ICE in gfc_conv_is_contiguous_expr, at fortran/trans-intrinsic.c:2857) 2019-09-29 Steven G. Kargl PR fortran/91641 * check.c (gfc_check_is_contiguous): null() cannot be an actual argument to is_contiguous(). 2019-09-29 Steven G. Kargl PR fortran/91641 * gfortran.dg/pr91641.f90: New test. From-SVN: r276272 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/check.c | 9 ++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr91641.f90 | 7 +++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr91641.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d4f39cc6dfa..694fc3278b0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-09-29 Steven G. Kargl + + PR fortran/91641 + * check.c (gfc_check_is_contiguous): null() cannot be an actual + argument to is_contiguous(). + 2019-09-29 Steven G. Kargl PR fortran/91714 diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index a04f9fbb2a9..98203bcd839 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -7098,6 +7098,14 @@ gfc_check_ttynam_sub (gfc_expr *unit, gfc_expr *name) bool gfc_check_is_contiguous (gfc_expr *array) { + if (array->expr_type == EXPR_NULL + && array->symtree->n.sym->attr.pointer == 1) + { + gfc_error ("Actual argument at %L of %qs intrinsic shall be an " + "associated pointer", &array->where, gfc_current_intrinsic); + return false; + } + if (!array_check (array, 0)) return false; @@ -7105,7 +7113,6 @@ gfc_check_is_contiguous (gfc_expr *array) } - bool gfc_check_isatty (gfc_expr *unit) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 052fd2e1f8a..43dc4ce65ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-29 Steven G. Kargl + + PR fortran/91641 + * gfortran.dg/pr91641.f90: New test. + 2019-09-29 Steven G. Kargl PR fortran/91714 diff --git a/gcc/testsuite/gfortran.dg/pr91641.f90 b/gcc/testsuite/gfortran.dg/pr91641.f90 new file mode 100644 index 00000000000..1970824a946 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91641.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR fortran/91641 +! Code conyributed by Gerhard Steinmetz +program p + real, pointer :: z(:) + print *, is_contiguous (null(z)) ! { dg-error "shall be an associated" } +end -- 2.30.2