target/7371: code generation bug for mips-64
Mon Jul 22 05:56:00 GMT 2002

>Number:         7371
>Category:       target
>Synopsis:       Negative offsets const arrays result in Sig BUS
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 22 05:26:01 PDT 2002
>Originator:     Niels Nes
>Release:        3.1
System: IRIX64 medusa 6.5 10100655 IP27

host: mips-sgi-irix6.5
build: mips-sgi-irix6.5
target: mips-sgi-irix6.5
configured with: ../configure --prefix=/soft/gcc-3.1
	The following small example gives a SIG BUS when compiled with
	-mabi=64. Only happens with const arrays and a const offset. 
	In the assembly code a line .dword  a-16 combining
	the two can be found (possibly a problem on a mips (I'm not sure)).

#include <stdio.h>

static const int a [] = {
	0, 1, 4, 6, 

	int i = 0;
		printf( "%d %d\n", i, a [i - 4] );
	Work around: remove the keyword const. 

More information about the Gcc-bugs mailing list