diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2020-03-05 11:41:14 +0000 |
---|---|---|
committer | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-03-05 11:41:14 +0000 |
commit | a2ec7c4aafbcd517eb563f1df32eedf39b27141b (patch) | |
tree | 861470c13c40f2394d6d9233b88b33cd18a3e664 /gcc/fortran/decl.c | |
parent | 43031fbdda7d4edbd607365a4f3bbec069fe3983 (diff) | |
download | gcc-a2ec7c4aafbcd517eb563f1df32eedf39b27141b.zip gcc-a2ec7c4aafbcd517eb563f1df32eedf39b27141b.tar.gz gcc-a2ec7c4aafbcd517eb563f1df32eedf39b27141b.tar.bz2 |
Fortran: ICE in gfc_code2string PR93792
A BOZ constant can not appear as a component inialiser for a derived
type.
gcc/fortran/ChangeLog:
PR93792
* decl.c (variable_decl): If param and initializer check
for BOZ, if found, output an error, set m to MATCH_ERROR
and goto cleanup.
gcc/testsuite/ChangeLog:
PR93792
* gfortran.dg/pr93792.f90: New test.
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 7382fea..2f458c4 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2929,7 +2929,16 @@ variable_decl (int elem) goto cleanup; } else if (param && initializer) - param->value = gfc_copy_expr (initializer); + { + if (initializer->ts.type == BT_BOZ) + { + gfc_error ("BOZ literal constant at %L cannot appear as an " + "initializer", &initializer->where); + m = MATCH_ERROR; + goto cleanup; + } + param->value = gfc_copy_expr (initializer); + } } /* Before adding a possible initilizer, do a simple check for compatibility |