From: Steven G. Kargl Date: Sun, 15 Sep 2019 17:49:44 +0000 (+0000) Subject: re PR fortran/91727 (ICE in conformable_arrays, at fortran/resolve.c:7490) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6e3aa01aa4b9e5d7e1cc69ec134d89cabdfd018;p=gcc.git re PR fortran/91727 (ICE in conformable_arrays, at fortran/resolve.c:7490) 2019-09-15 Steven G. Kargl PR fortran/91727 * resolve.c (conformable_arrays): If array-spec is NULL, then allocate-object is a scalar. a conformability check only occurs for an array source-expr. 2019-09-15 Steven G. Kargl PR fortran/91727 * gfortran.dg/pr91727.f90: New test. From-SVN: r275731 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1006cbda2f4..7b383b3a4f3 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-09-15 Steven G. Kargl + + PR fortran/91727 + * resolve.c (conformable_arrays): If array-spec is NULL, then + allocate-object is a scalar. a conformability check only occurs + for an array source-expr. + 2019-09-15 Thomas Koenig PR fortran/91550 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index ce192bbb189..f1de7dd76c6 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -7485,7 +7485,7 @@ conformable_arrays (gfc_expr *e1, gfc_expr *e2) for (tail = e2->ref; tail && tail->next; tail = tail->next); /* First compare rank. */ - if ((tail && e1->rank != tail->u.ar.as->rank) + if ((tail && (!tail->u.ar.as || e1->rank != tail->u.ar.as->rank)) || (!tail && e1->rank != e2->rank)) { gfc_error ("Source-expr at %L must be scalar or have the " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c06029ac75c..786e6a43b1a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-15 Steven G. Kargl + + PR fortran/91727 + * gfortran.dg/pr91727.f90: New test. + 2019-09-15 Thomas Koenig PR fortran/91550 diff --git a/gcc/testsuite/gfortran.dg/pr91727.f90 b/gcc/testsuite/gfortran.dg/pr91727.f90 new file mode 100644 index 00000000000..54276b45d33 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91727.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! Code contributed by Gerhard Steinmetz. +program p + type t + class(*), allocatable :: a + end type + type(t) :: x + allocate (x%a, source=[1]) ! { dg-error "have the same rank as" } +end