]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: fix regression introduced by commit r16-914-g787a8dec1acedf
authorHarald Anlauf <anlauf@gmx.de>
Tue, 27 May 2025 21:08:54 +0000 (23:08 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Tue, 27 May 2025 21:13:05 +0000 (23:13 +0200)
A last-minute cleanup before patch submission reordered a change
that should not have happened.  This fixes it.

PR fortran/101735

gcc/fortran/ChangeLog:

* primary.cc (gfc_match_varspec): Correct order of logic.

gcc/fortran/primary.cc

index 426c994e67d175dec7dc3d46a0f4acfd5a2fad88..db5fc5de814192517f4e0e35d33f49238cbfe834 100644 (file)
@@ -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;