https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124041
Bug ID: 124041
Summary: [16 regression] ICE in lra_eliminate_regs_1, at
lra-eliminations.cc:665
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: arnd at linaro dot org
Target Milestone: ---
I ran into one ICE while compile-testing randconfig Linux kernels with
gcc-16.0.1, managed to reduce it to this test case:
char *trick_compiler(void *);
int do_usercopy_stack_callee_i;
char *do_usercopy_stack_callee(long value)
{
char buf[28];
for (; do_usercopy_stack_callee_i < sizeof(buf);
do_usercopy_stack_callee_i++)
buf[do_usercopy_stack_callee_i] = value;
return trick_compiler(buf);
}
void do_usercopy_stack(void)
{
char *bad_stack;
bad_stack = do_usercopy_stack_callee((long)&bad_stack);
}
$ aarch64-linux-gcc -c -O2 -fno-strict-aliasing -fstack-protector
-ftrivial-auto-var-init=zero -fsanitize=thread -Wall
during RTL pass: reload
<source>: In function 'do_usercopy_stack':
<source>:14:1: internal compiler error: in lra_eliminate_regs_1, at
lra-eliminations.cc:665
14 | }
| ^
https://godbolt.org/z/xPM193McK
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/misc/lkdtm/usercopy.c#n55
So far this showed up once in hundreds of randconfig builds across multiple
architectures.
Originally found with gcc-16.0.1 but reproduced on today's HEAD at
3e7dd06860bf. Filed as 'target' specific since the reproducer seems fine on the
other 25 targets.