diff options
author | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-08-21 06:39:30 +0100 |
---|---|---|
committer | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-08-27 15:12:10 +0100 |
commit | c336eda750d4e7a0827fedf995da955d6d88d5ca (patch) | |
tree | 885de20dcd69f4de23eb0ae46cd8c675ea2cf481 /gcc/fortran/decl.c | |
parent | eb68d9d828f94d28afa5900fbf3072bbcd64ba8a (diff) | |
download | gcc-c336eda750d4e7a0827fedf995da955d6d88d5ca.zip gcc-c336eda750d4e7a0827fedf995da955d6d88d5ca.tar.gz gcc-c336eda750d4e7a0827fedf995da955d6d88d5ca.tar.bz2 |
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.
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index d854b2a..c612b492 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1146,6 +1146,9 @@ char_len_param_value (gfc_expr **expr, bool *deferred) gfc_free_expr (e); } + if (gfc_seen_div0) + m = MATCH_ERROR; + return m; syntax: |