https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101735
--- Comment #11 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #10)
> Seems like some last-minute cleanup before submission broke something.
> I'll have a look.
It was the last-minute cleanup. Duh!
This fixes it:
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 426c994e67d..be43be3198b 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -2686,16 +2686,17 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag,
bool sub_flag,
else if (component == NULL && !inquiry)
return MATCH_ERROR;
- /* Find end of reference chain if inquiry reference and tail not set.
*/
- if (tail == NULL && inquiry && tmp)
- tail = extend_ref (primary, tail);
-
/* Extend the reference chain determined by gfc_find_component or
is_inquiry_ref. */
if (primary->ref == NULL)
primary->ref = tmp;
else
{
+ /* Find end of reference chain if inquiry reference and tail not
+ set. */
+ if (tail == NULL && inquiry && tmp)
+ tail = extend_ref (primary, tail);
+
/* Set by the for loop below for the last component ref. */
gcc_assert (tail != NULL);
tail->next = tmp;
Unfortunately I cannot build HEAD of trunk because of r16-916-g517c9487f8fdc4.