]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran : ICE for division by zero in declaration PR95882
authorMark Eggleston <markeggleston@gcc.gnu.org>
Fri, 21 Aug 2020 05:39:30 +0000 (06:39 +0100)
committerMark Eggleston <markeggleston@gcc.gnu.org>
Thu, 27 Aug 2020 16:09:50 +0000 (17:09 +0100)
commit042c58a4b8ba48fdf26c9003154e9d3b83d4c568
tree630e687db08361ffabf919c4c5aba372a7645c55
parent967a5f8e585a5d499870903849c0fa06c326547a
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-27  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/fortran

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

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

gcc/testsuite/

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.

(cherry picked from commit c336eda750d4e7a0827fedf995da955d6d88d5ca)
gcc/fortran/decl.c
gcc/testsuite/gfortran.dg/pr95882_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr95882_2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr95882_3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr95882_4.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr95882_5.f90 [new file with mode: 0644]