[Patch, fortran] PR98458 - ICE in gfc_conv_array_initializer due to array expressions within implied do-loop

Paul Richard Thomas paul.richard.thomas@gmail.com
Tue Jan 5 12:09:57 GMT 2021


This is another obvious patch. The first version of the patch just expanded
the constructor. Steve used gfc_reduce_init_expr to fix the immediate
problem within simplify_reshape. Since this has the advantage of doing the
type check as well and so I incorporated it in this inclusive patch.

Regtested on FC33/x86_64 - OK for master (and 9-/10-branches)?

Paul

Fortran:Fix simplification of constructors with implied-do [PR98458]

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

gcc/fortran
PR fortran/98458
* simplify.c (is_constant_array_expr): If an array constructor
expression has elements other than constants or structures, try
fixing the expression with gfc_reduce_init_expr. Also, if shape
is NULL, obtain the array size and set it.

gcc/testsuite/
PR fortran/98458
* gfortran.dg/implied_do_3.f90 : New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 1609 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20210105/6c072a3f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implied_do_3.f90
Type: text/x-fortran
Size: 429 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20210105/6c072a3f/attachment-0001.bin>


More information about the Fortran mailing list