On 4/12/11 10:05 PM, Russell Whitaker wrote:
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.
[..]
Russel,
Not sure what you tried, but they all compile without error. You have to wrap example 2 and 3 with
typedef unsigned int u32; #define DEFAULT_RCBA 0xfed1c000 #define GCS 0x3410 void test(void) {
and
}
before actually running them through gcc.