Bug 70278 - [6 regression] LRA ICE on trunk for ARM Thumb1 with Os
Summary: [6 regression] LRA ICE on trunk for ARM Thumb1 with Os
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2016-03-17 15:08 UTC by Andre Vieira
Modified: 2016-03-21 17:40 UTC (History)
2 users (show)

See Also:
Host:
Target: arm-none-eabi
Build:
Known to work:
Known to fail: 6.0
Last reconfirmed: 2016-03-17 00:00:00


Attachments
reduced e_hypot.c (577 bytes, text/x-csrc)
2016-03-17 15:08 UTC, Andre Vieira
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Vieira 2016-03-17 15:08:58 UTC
Created attachment 37999 [details]
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.
Comment 1 Ramana Radhakrishnan 2016-03-17 15:20:21 UTC
confirmed.
Comment 2 Bernd Schmidt 2016-03-18 19:09:40 UTC
Author: bernds
Date: Fri Mar 18 19:09:08 2016
New Revision: 234342

URL: https://gcc.gnu.org/viewcvs?rev=234342&root=gcc&view=rev
Log:
Fix PR70278, a problem with the previous split_reg change

	PR rtl-optimization/70278
	* lra-constraints.c (split_reg): Handle the case where biggest_mode is
	VOIDmode.

testsuite/
	* gcc.dg/torture/pr70278.c: New test.
	* gcc.target/arm/pr70278.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr70278.c
    trunk/gcc/testsuite/gcc.target/arm/pr70278.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lra-constraints.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Andre Vieira 2016-03-21 17:40:35 UTC
This fixes it on our end. Thank you Bernd. 
Marking this as RESOLVED FIXED.