diff mbox series

[fortran] PR98472 - internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352

Message ID CAGkQGiLX+dbZRd0czrnihsSQ8UH38FTMCmpRFjvbzBPxj0grZw@mail.gmail.com
State New
Headers show
Series [fortran] PR98472 - internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 | expand

Commit Message

Paul Richard Thomas Jan. 27, 2021, 9:20 a.m. UTC
I have applied another obvious patch to fix this PR. It was tempting to
remove both gcc-asserts but I have erred on the side of caution this time.

Commit r11-6924-g003f0414291d595d2126e6d2e24b281f38f3448f

Again, it is sufficiently safe and obvious that I am tempted to put it on
my list of backports.

Paul

Fortran: Fix ICE due to elemental procedure pointers [PR98472].

2021-01-27  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/98472
* trans-array.c (gfc_conv_expr_descriptor): Include elemental
procedure pointers in the assert under the comment 'elemental
function' and eliminate the second, spurious assert.

gcc/testsuite/
PR fortran/98472
* gfortran.dg/elemental_function_5.f90 : New test.
diff mbox series

Patch

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 4bd4db877bd..c346183e129 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7477,9 +7477,9 @@  gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
 			 && expr->value.function.esym->attr.elemental)
 			|| (expr->value.function.isym != NULL
 			    && expr->value.function.isym->elemental)
+			|| (gfc_expr_attr (expr).proc_pointer
+			    && gfc_expr_attr (expr).elemental)
 			|| gfc_inline_intrinsic_function_p (expr));
-	  else
-	    gcc_assert (ss_type == GFC_SS_INTRINSIC);
 
 	  need_tmp = 1;
 	  if (expr->ts.type == BT_CHARACTER