[PATCH] Fortran : Runtime error, reshape constant array assignment, PR96624

Mark Eggleston mark.eggleston@codethink.co.uk
Thu Aug 20 07:05:08 GMT 2020

Please find attached a fix for PR96624.  The original patch was by Steve 

Also occurs on releases/gcc-10, releases/gcc-9 and releases/gcc-8 branches.

OK to commit to master and backport?

[PATCH] Fortran  : Runtime error, reshape constant array assignment  PR96624

When assigning a reshaped constant array of shape [2,0] to a
variable fails with an invalid memory access.  If a varibale
with the parameter attribute is initialised with the same reshape
there is no runtime error.

2020-08-20  Steven G. Kargl  <kargl@gcc.gnu.org>


     PR fortran/96624
     * simplify.c (gfc_simplifiy_reshape): Add new variable "zerosize".
     Set zerosize if any of the result shape ranks are zero.  After
     setting the result shapes, if zerosize is set jump to new label
     "sizezero".  Add label "sizezero" just before clearing index and
     returning result.

2020-08-20  Mark Eggleston <markeggleston@gcc.gnu.org>


     PR fortran/96624
     *gfortran/pr96624.f90: New test.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fortran-Runtime-error-reshape-constant-array-assignm.patch
Type: text/x-patch
Size: 2552 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200820/bd3c27f8/attachment.bin>

More information about the Gcc-patches mailing list