https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109609

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yeah, exactly, the difference between the two revisions is first in tailc pass:
--- pr109609.C.202t.tailc_      2023-04-24 15:48:33.000000000 -0400
+++ pr109609.C.202t.tailc       2023-04-24 15:49:08.000000000 -0400
@@ -44,7 +44,7 @@ void invert (const char * id)
   <bb 4> [local count: 137085153]:
   # ptr_27 = PHI <ptr_10(3), &MEM <char[13]> [(void *)&buf + 12B](2)>
   __builtin_printf ("Src: %s\n", ptr_27);
-  __builtin_strncpy (&dst, ptr_27, 23);
+  __builtin_strncpy (&dst, ptr_27, 23); [tail call]
   buf ={v} {CLOBBER};
   return;

Obviously, we shouldn't tail call strncpy when the second argument points into
an automatic variable in the current function.

Reply via email to