[Bug rtl-optimization/60260] New: MIPS sign extension issue
jan.smets@alcatel-lucent.com
gcc-bugzilla@gcc.gnu.org
Tue Feb 18 10:36:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60260
Bug ID: 60260
Summary: MIPS sign extension issue
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: jan.smets@alcatel-lucent.com
GCC 4.8.2
mips-wrs-vxworks
-c test.c -o test -Wall -O2 -mabi=32
int main()
{
volatile unsigned int * ptr;
unsigned int end = 0x7fbfff80U;
unsigned int * eptr = (unsigned int*)0x80000000U;
#define CACHE_LINE_SIZE 32
for (ptr = (volatile unsigned int *) end; ptr < eptr; ptr +=
CACHE_LINE_SIZE / sizeof(*ptr))
{
//printf("ptr=%p\n", ptr);
*ptr = *ptr;
}
return 0;
}
00000000 <main>:
0: 3c027fbf lui v0,0x7fbf
4: 3442ff80 ori v0,v0,0xff80
8: 3c048000 lui a0,0x8000
c: 8c430000 lw v1,0(v0) .. then when v0 reaches
7FFFFFE0 ...
10: 24420020 addiu v0,v0,32 result is 8000.0000 and
signed extended ?
14: ac43ffe0 sw v1,-32(v0) <======= crash here on addr
0xFFFFFFFF.7FFFFFE0
18: 1444fffc bne v0,a0,c <main+0xc>
1c: 00000000 nop
20: 03e00008 jr ra
24: 00001021 move v0,zero
When -fno-schedule-insns -fno-schedule-insns2 is used then the add is done
after the load/stores. (Which is what GCC 4.6 does)
(Or daddiu may solve this too I think)
More information about the Gcc-bugs
mailing list