[PATCH] Fortran : ICE for division by zero in declaration PR95882

Mark Eggleston mark.eggleston@codethink.co.uk
Mon Aug 24 07:03:48 GMT 2020

Please find attached a fix for PR95882.

Tested on x86_64 with bootstrap.

OK to commit and backport?

Fortran  : ICE for division by zero in declaration PR95882

A length expression containing a divide by zero in a character
declaration will result in an ICE if the constant is anymore
complicated that a contant divided by a constant.

The cause was that char_len_param_value can return MATCH_YES
even if a divide by zero was seen.  Prior to returning check
whether a divide by zero was seen and if so set it to MATCH_ERROR.

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


     PR fortran/95882
     * decl.c (char_len_param_value): Check gfc_seen_div0 and
     if it is set return MATCH_ERROR.

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


     PR fortran/95882
     * gfortran.dg/pr95882_1.f90: New test.
     * gfortran.dg/pr95882_2.f90: New test.
     * gfortran.dg/pr95882_3.f90: New test.
     * gfortran.dg/pr95882_4.f90: New test.
     * gfortran.dg/pr95882_5.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/20200824/6ae1f2af/attachment.bin>

More information about the Gcc-patches mailing list