diff options
author | Steve Kargl <kargl@gcc.gnu.org> | 2020-04-20 13:21:38 +0200 |
---|---|---|
committer | Thomas König <tkoenig@gcc.gnu.org> | 2020-04-20 13:21:38 +0200 |
commit | 38acc41d6d761b635123eefa93743b9139debbae (patch) | |
tree | 9a7ea2c6e1a9b415250b040b5bd0573b4613df55 /gcc/fortran | |
parent | 85d8c05a02bf7d1b256f806582a11e3fd8970a32 (diff) | |
download | gcc-38acc41d6d761b635123eefa93743b9139debbae.zip gcc-38acc41d6d761b635123eefa93743b9139debbae.tar.gz gcc-38acc41d6d761b635123eefa93743b9139debbae.tar.bz2 |
PR 91800 - reject Hollerith constants as type initializer.
2020-04-20 Steve Kargl <kargl@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/91800
* decl.c (variable_decl): Reject Hollerith constants as type
initializer.
2020-04-20 Steve Kargl <kargl@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/91800
* gfortran.dg/hollerith_9.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 336ce490..2671c1a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2020-04-20 Steve Kargl <kargl@gcc.gnu.org> + Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/91800 + * decl.c (variable_decl): Reject Hollerith constants as type + initializer. + 2020-04-19 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/93500 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index b3ed63c..d650407 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2904,6 +2904,15 @@ variable_decl (int elem) } if (gfc_current_state () == COMP_DERIVED + && initializer && initializer->ts.type == BT_HOLLERITH) + { + gfc_error ("Initialization of structure component with a HOLLERITH " + "constant at %L is not allowed", &initializer->where); + m = MATCH_ERROR; + goto cleanup; + } + + if (gfc_current_state () == COMP_DERIVED && gfc_current_block ()->attr.pdt_template) { gfc_symbol *param; |