A runtime system might legitimately hold in rbx a value expected to be
preserved across the call to main, but its use as a global register
variable stops main from preserving it.
for gcc/testsuite/ChangeLog
PR rtl-optimization/51447
* gcc.c-torture/execute/pr51447.c (main): Preserve call-saved
register.
main (void)
{
__label__ nonlocal_lab;
+#ifdef __x86_64__
+ void *save = ptr;
+#endif
__attribute__((noinline, noclone)) void
bar (void *func)
{
nonlocal_lab:
if (ptr != &&nonlocal_lab)
abort ();
+#ifdef __x86_64__
+ ptr = save; /* Restore the call-saved register. */
+#endif
return 0;
}