https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81724
Bug ID: 81724 Summary: ICE in expand_stack_vars Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org Target Milestone: --- For nvptx, we see this ICE: ... FAIL: gcc.dg/memcmp-1.c (internal compiler error) ... In more detail: ... during RTL pass: expand gcc/testsuite/gcc.dg/strcmp-1.c: In function 'test_strcmp_3_1': gcc/testsuite/gcc.dg/strcmp-1.c:13:13: internal compiler error: RTL check: expected code 'const_int', have 'reg' in expand_stack_vars, at cfgexpand.c:1186 /home/vries/nvptx/mainkernel-2/source-gcc/gcc/testsuite/gcc.dg/strcmp-1.c:331:1: note: in expansion of macro 'DEF_TEST' 0x54f895 rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int, char const*)^M gcc/rtl.c:829 0x6ea5e9 expand_stack_vars gcc/cfgexpand.c:1186 0x6fa3d3 expand_used_vars gcc/cfgexpand.c:2241 0x6fbee2 execute gcc/cfgexpand.c:6230 ... The relevant part in expand_stack_vars is this: ... /* If there were any variables requiring "large" alignment, allocate space. */ if (large_size > 0 && ! large_allocation_done) { HOST_WIDE_INT loffset; rtx large_allocsize; large_allocsize = GEN_INT (large_size); get_dynamic_stack_size (&large_allocsize, 0, large_align, NULL); loffset = alloc_stack_frame_space (INTVAL (large_allocsize), PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT); large_base = get_dynamic_stack_base (loffset, large_align); large_allocation_done = true; } gcc_assert (large_base != NULL); ... The ICE happens because get_dynamic_stack_size returns a reg in large_allocsize: ... (gdb) #6 0x00000000006ea5ea in expand_stack_vars (pred=pred@entry=0x0, data=data@entry=0x7fffffffd440) at /home/vries/nvptx/mainkernel-2/source-gcc/gcc/cfgexpand.c:1186 1186 (INTVAL (large_allocsize), (gdb) call debug_rtx (large_allocsize) (reg:DI 61) ... while INTVAL (large_allocsize) expects an constant int.