Hello world, I just committed as obvious (alternatively, reviewed and committed) Steve's patch for PR 91800 from the PR, after regression-testing.
Regards Thomas PR 91800 - reject Hollerith constants as type initializer. 2020-04-20 Steve Kargl <ka...@gcc.gnu.org> Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/91800 * decl.c (variable_decl): Reject Hollerith constants as type initializer. 2020-04-20 Steve Kargl <ka...@gcc.gnu.org> Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/91800 * gfortran.dg/hollerith_9.f90: New test.
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index b3ed63c97cc..d650407da41 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2903,6 +2903,15 @@ variable_decl (int elem) goto cleanup; } + 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) {
! { dg-do compile } ! PR 91800 - this used to cause an ICE. module m type t(n) ! { dg-error "does not have a component corresponding to parameter" } integer, len :: n = 4habcd ! { dg-error "Initialization of structure component with a HOLLERITH constant" } end type end