builtins: Fix up two bugs in access_ref::inform_access [PR98721]
[gcc.git] / gcc / builtins.c
index c1115a32d91c08dd0e8075af654a51fae7de2f7d..0aed008687ccc9ca81f5f1d340b3d7c4a1fa2990 100644 (file)
@@ -4414,8 +4414,8 @@ access_ref::inform_access (access_mode mode) const
         MAXREF on which the result is based.  */
       const offset_int orng[] =
        {
-        offrng[0] - maxref.offrng[0],
-        wi::smax (offrng[1] - maxref.offrng[1], offrng[0]),
+         offrng[0] - maxref.offrng[0],
+         wi::smax (offrng[1] - maxref.offrng[1], offrng[0]),
        };
 
       /* Add the final PHI's offset to that of each of the arguments
@@ -4493,12 +4493,15 @@ access_ref::inform_access (access_mode mode) const
              /* Strip the SSA_NAME suffix from the variable name and
                 recreate an identifier with the VLA's original name.  */
              ref = gimple_call_lhs (stmt);
-             ref = SSA_NAME_IDENTIFIER (ref);
-             const char *id = IDENTIFIER_POINTER (ref);
-             size_t len = strcspn (id, ".$");
-             if (!len)
-               len = strlen (id);
-             ref = get_identifier_with_length (id, len);
+             if (SSA_NAME_IDENTIFIER (ref))
+               {
+                 ref = SSA_NAME_IDENTIFIER (ref);
+                 const char *id = IDENTIFIER_POINTER (ref);
+                 size_t len = strcspn (id, ".$");
+                 if (!len)
+                   len = strlen (id);
+                 ref = get_identifier_with_length (id, len);
+               }
            }
          else
            {
@@ -4557,13 +4560,13 @@ access_ref::inform_access (access_mode mode) const
       return;
     }
 
-  if (DECL_P (ref))
+  if (allocfn == NULL_TREE)
     {
       if (*offstr)
-       inform (loc, "at offset %s into source object %qD of size %s",
+       inform (loc, "at offset %s into source object %qE of size %s",
                offstr, ref, sizestr);
       else
-       inform (loc, "source object %qD of size %s", ref,  sizestr);
+       inform (loc, "source object %qE of size %s", ref, sizestr);
 
       return;
     }