https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70278
Bug ID: 70278 Summary: LRA ICE on trunk for ARM Thumb1 with Os Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: andre.simoesdiasvieira at arm dot com Target Milestone: --- Created attachment 37999 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37999&action=edit reduced e_hypot.c Hello, We are running into an ICE in lra on trunk when compiling newlib for an ARM thumb1 target with -Os. This happens when compiling newlib/libm/math/e_hypot.c See the attached reduced source and the error when executing the command below: $arm-none-eabi-gcc -march=armv4t -mthumb -Os -S besttry.c The error: besttry.c: In function '__ieee754_hypot': besttry.c:27:1: internal compiler error: in lra_create_new_reg_with_unique_value, at lra.c:188 } ^ 0x94d30b lra_create_new_reg_with_unique_value(machine_mode, rtx_def*, reg_class, char const*) ../src/gcc/lra.c:188 0x94d358 lra_create_new_reg(machine_mode, rtx_def*, reg_class, char const*) ../src/gcc/lra.c:228 0x9590e4 split_reg ../src/gcc/lra-constraints.c:5034 0x95a2da split_if_necessary ../src/gcc/lra-constraints.c:5142 0x95e08c inherit_in_ebb ../src/gcc/lra-constraints.c:5527 0x95e08c lra_inheritance() ../src/gcc/lra-constraints.c:5813 0x950900 lra(_IO_FILE*) ../src/gcc/lra.c:2312 0x9082d1 do_reload ../src/gcc/ira.c:5408 0x9082d1 execute ../src/gcc/ira.c:5592 My initial investigation into lra shows that this is due to split_reg calling lra_create_new_reg with mode = VOIDmode. Others with more lra experience might be able to spot the origin of the issue quicker though. A bisect shows that this seems to be introduced with revision r234184 where reg split now calls lra_create_new_reg with 'mode' that seems to be set by 'lra_reg_info[hard_regno].biggest_mode' which in our case will be SImode. This mode is passed down to lra_create_new_reg_with_unique_value which asserts if its not VOIDmode. Cheers, Andre PS: Unrelated to this, the code in lra_create_new_reg_with_unique_value looks a bit odd, I think mode should have been initialized with VOIDmode there.