From what I can see, the vla-1.c test has been added to test the handling
of debug info for optimized out parameters. But recent changes don't make
the argument optimized away, but optimized away and replaced by constant 5
(even without IPA-VRP). The function is noinline, but can't be noclone
nor noipa exactly because we want to test how it behaves when it is cloned
and the unused argument is dropped.
So, the following patch arranges to hide from the IPA optimizations the
value of x in the caller (and even make sure it is preserved in a register
or stack slot in the caller across the call).
2025-11-25 Jakub Jelinek <jakub@redhat.com>
PR testsuite/119931
* gcc.dg/vla-1.c (main): Hide x value from optimizers and use it after
the call as well.
{
volatile int j;
int x = 5;
+ asm volatile ("" : "+r" (x));
j = f1 (x);
+ asm volatile ("" : "+r" (x));
return 0;
}
/* One debug source bind is generated for the parameter, and one to describe the
sizes of a and b. */
/* { dg-final { scan-tree-dump-times " s=> i" 2 "optimized" } } */
-