diff mbox

[nios2,committed] fix bad assertion

Message ID 559179DB.8020505@codesourcery.com
State New
Headers show

Commit Message

Sandra Loosemore June 29, 2015, 5:01 p.m. UTC
When I was preparing to regression-test something else in a 
nios2-linux-gnu build, I discovered it was ICE'ing while building shared 
libraries with -fpic (glibc, libgomp).  I tracked this down to having 
started with r224048, but on further investigation I decided that commit 
merely exposed a latent bug.

The trouble is that the assertion in nios2_delegitimize_address is too 
restrictive compared to what nios2_legitimize_address can produce.  It's 
expecting to find a SYMBOL_REF underneath but in one case it was 
crashing on a LABEL_REF (for a computed goto), and in another case it 
was a symbol + offset expression which is even documented with a big 
block of comments in nios2_legitimize_address.  I've checked in this 
patch to relax the assertion; it allows the toolchain to build again, 
and test results look decent.

-Sandra

Comments

Chung-Lin Tang May 21, 2016, 8:30 a.m. UTC | #1
On 2015/6/30 1:01 AM, Sandra Loosemore wrote:
> When I was preparing to regression-test something else in a nios2-linux-gnu build, I discovered it was ICE'ing while building
> shared libraries with -fpic (glibc, libgomp).  I tracked this down to having started with r224048, but on further investigation
> I decided that commit merely exposed a latent bug.
> 
> The trouble is that the assertion in nios2_delegitimize_address is too restrictive compared to what nios2_legitimize_address can
> produce.  It's expecting to find a SYMBOL_REF underneath but in one case it was crashing on a LABEL_REF (for a computed goto),
> and in another case it was a symbol + offset expression which is even documented with a big block of comments in
> nios2_legitimize_address.  I've checked in this patch to relax the assertion; it allows the toolchain to build again, and test
> results look decent.
> 
> -Sandra
> 

This was backported to gcc-5-branch, to fix that ICE Marek encountered.

Chung-Lin
diff mbox

Patch

Index: gcc/config/nios2/nios2.c
===================================================================
--- gcc/config/nios2/nios2.c	(revision 225094)
+++ gcc/config/nios2/nios2.c	(working copy)
@@ -1920,7 +1920,7 @@  nios2_delegitimize_address (rtx x)
 	case UNSPEC_LOAD_TLS_IE:
 	case UNSPEC_ADD_TLS_LE:
 	  x = XVECEXP (XEXP (x, 0), 0, 0);
-	  gcc_assert (GET_CODE (x) == SYMBOL_REF);
+	  gcc_assert (CONSTANT_P (x));
 	  break;
 	}
     }