This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This is the fix for the PR.
Attachment:
pr54730_v23-5.CL
Description: Text document
diff --git a/array.c b/array.c index 6787c05..b4a028b 100644 --- a/array.c +++ b/array.c @@ -1046,6 +1046,7 @@ match gfc_match_array_constructor (gfc_expr **result) { gfc_constructor_base head, new_cons; + gfc_change_set changed_syms; gfc_expr *expr; gfc_typespec ts; locus where; @@ -1074,6 +1075,7 @@ gfc_match_array_constructor (gfc_expr **result) /* Try to match an optional "type-spec ::" */ gfc_clear_ts (&ts); + gfc_new_checkpoint (changed_syms); if (gfc_match_decl_type_spec (&ts, 0) == MATCH_YES) { seen_ts = (gfc_match (" ::") == MATCH_YES); @@ -1082,19 +1084,28 @@ gfc_match_array_constructor (gfc_expr **result) { if (gfc_notify_std (GFC_STD_F2003, "Array constructor " "including type specification at %C") == FAILURE) - goto cleanup; + { + gfc_restore_last_checkpoint (); + goto cleanup; + } if (ts.deferred) { gfc_error ("Type-spec at %L cannot contain a deferred " "type parameter", &where); + gfc_restore_last_checkpoint (); goto cleanup; } } } - if (! seen_ts) - gfc_current_locus = where; + if (seen_ts) + gfc_drop_last_checkpoint (); + else + { + gfc_restore_last_checkpoint (); + gfc_current_locus = where; + } if (gfc_match (end_delim) == MATCH_YES) {
Attachment:
pr54730-test.CL
Description: Text document
! { dg-do compile } ! ! PR fortran/54730 ! A symbol 'a' was created while attempting to parse a typespec in the array ! constructor. That (invalid) symbol was kept until translation stage ! where it was leading to an ICE. ! ! Original testcase from Paul Kapinos <kapinos@rz.rwth-aachen.de> ! subroutine s implicit none intrinsic :: real real :: vec(1:2) vec = (/ real(a = 1), 1. /) end subroutine s program main implicit none intrinsic :: real print *,(/ real(a = 1) /) end
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |