]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR middle-end/100574 - ICE in size_remaining, at builtins.c
authorMartin Sebor <msebor@redhat.com>
Thu, 13 May 2021 22:20:45 +0000 (16:20 -0600)
committerMartin Sebor <msebor@redhat.com>
Thu, 13 May 2021 22:20:45 +0000 (16:20 -0600)
gcc/ChangeLog:

PR middle-end/100574
* builtins.c (access_ref::get_ref): Improve detection of PHIs with
all null arguments.

gcc/builtins.c

index 2f0efae11e8ca873f1dd81ec592b9e9b7dec74e9..e1b284846b1d1c530165c1c9a4de50eef600c9f2 100644 (file)
@@ -362,15 +362,6 @@ access_ref::get_ref (vec<access_ref> *all_refs,
        same_ref.offrng[1] = phi_arg_ref.offrng[1];
     }
 
-  if (phi_ref.sizrng[0] < 0)
-    {
-      /* Fail if none of the PHI's arguments resulted in updating PHI_REF
-        (perhaps because they have all been already visited by prior
-        recursive calls).  */
-      psnlim->leave_phi (ref);
-      return NULL_TREE;
-    }
-
   if (!same_ref.ref && same_ref.offrng[0] != 0)
     /* Clear BASE0 if not all the arguments refer to the same object and
        if not all their offsets are zero-based.  This allows the final
@@ -390,6 +381,15 @@ access_ref::get_ref (vec<access_ref> *all_refs,
       phi_ref.parmarray = parmarray;
     }
 
+  if (phi_ref.sizrng[0] < 0)
+    {
+      /* Fail if none of the PHI's arguments resulted in updating PHI_REF
+        (perhaps because they have all been already visited by prior
+        recursive calls).  */
+      psnlim->leave_phi (ref);
+      return NULL_TREE;
+    }
+
   /* Avoid changing *THIS.  */
   if (pref && pref != this)
     *pref = phi_ref;