diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2022-01-04 18:18:13 -0800 |
---|---|---|
committer | Sandra Loosemore <sandra@codesourcery.com> | 2022-01-05 09:02:22 -0800 |
commit | 85a3442c85aedb00c59e986f16cccbb8ec60d777 (patch) | |
tree | 2ad4990645d1b6927b0dc72f749b9fa41b35dc14 /gcc/fortran/decl.c | |
parent | 6aa0859afaf28f4fb13121352225bc5877e02a44 (diff) | |
download | gcc-85a3442c85aedb00c59e986f16cccbb8ec60d777.zip gcc-85a3442c85aedb00c59e986f16cccbb8ec60d777.tar.gz gcc-85a3442c85aedb00c59e986f16cccbb8ec60d777.tar.bz2 |
Fortran: Fix ICE caused by missing error for untyped symbol [PR103258]
The bit on a symbol to mark that it had already been diagnosed as
lacking a type was getting set even when the error was suppressed or
discarded, specifically when doing early resolution on a character
length expression to see if it can be constant-folded. Explicitly
suppress errors before doing that, then check whether they are
suppressed before setting the bit.
2022-01-04 Sandra Loosemore <sandra@codesourcery.com>
PR fortran/103258
gcc/fortran/
* decl.c (gfc_match_char_spec): Suppress errors around call
to gfc_reduce_init_expr.
* error.c (gfc_query_suppress_errors): New.
* gfortran.h (gfc_query_suppress_errors): Declare.
* symbol.c (gfc_set_default_type): Check gfc_query_suppress_errors.
gcc/testsuite/
* gfortran.dg/pr103258.f90: New.
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 4e510cc..c846923 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -3609,7 +3609,9 @@ done: gfc_current_ns = gfc_get_namespace (NULL, 0); e = gfc_copy_expr (len); + gfc_push_suppress_errors (); gfc_reduce_init_expr (e); + gfc_pop_suppress_errors (); if (e->expr_type == EXPR_CONSTANT) { gfc_replace_expr (len, e); |