On Tue, 12 Apr 2011, Stefan Reinauer wrote:
Hi,
just a heads up, I got romcc to segfault with the following sample program:
--------------------- 8< snip 8< -------------------------------------- typedef unsigned int u32; #define DEFAULT_RCBA 0xfed1c000 #define GCS 0x3410 #define RCBA32(x) *((volatile u32 *)(DEFAULT_RCBA + x))
void test(void) { RCBA32(GCS) &= (~0x04); } --------------------- >8 snip >8 --------------------------------------
I tried to simplify this further and this construct is still crashing romcc:
--------------------- 8< snip 8< -------------------------------------- u32 *gcs = (u32 *)(DEFAULT_RCBA + GCS); *gcs &= (~0x04); --------------------- >8 snip >8 --------------------------------------
while this one is working
--------------------- 8< snip 8< -------------------------------------- u32 *gcs = (u32 *)(DEFAULT_RCBA + GCS); u32 temp = *gcs; temp &= (~0x04); *gcs = temp; --------------------- >8 snip >8 --------------------------------------
Is that a construct that we just can't/don't want to support in romcc? Or is there a chance we can fix that?
Stefan
Just for comparison used gcc -S to compile the 3 snippets. The first compiled without error.
2nd: testc2.c:1:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token testc2.c:2:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&=' token
3rd: testc3.c:1:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token testc3.c:2:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'temp' testc3.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&=' token testc3.c:4:9: warning: data definition has no type or storage class testc3.c:4:16: error: 'temp' undeclared here (not in a function) testc3.c:5:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token testc3.c:6:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'temp' testc3.c:7:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&=' token testc3.c:8:9: warning: data definition has no type or storage class testc3.c:8:10: error: redefinition of 'gcs' testc3.c:4:10: note: previous definition of 'gcs' was here testc3.c:9:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token testc3.c:10:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'temp' testc3.c:11:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&=' token testc3.c:12:10: warning: data definition has no type or storage class testc3.c:12:11: error: redefinition of 'gcs' testc3.c:4:10: note: previous definition of 'gcs' was here
Russ