target/7371: code generation bug for mips-64
Niels.Nes@cwi.nl
Niels.Nes@cwi.nl
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
>Closed-Date:
>Last-Modified:
>Originator: Niels Nes
>Release: 3.1
>Organization:
CWI
>Environment:
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
>Description:
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,
};
main(){
int i = 0;
for(i=4;i<8;i++){
printf( "%d %d\n", i, a [i - 4] );
}
}
>How-To-Repeat:
>Fix:
Work around: remove the keyword const.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list