> well, it's doesn't seem to be very consistent about it then...
>
> static rwlock_t x = (rwlock_t) { { 1 }, 0 };
> is ok
>
> static rwlock_t x = { (spinlock_t) { 1 }, 0 };
> is also ok
>
> only when you have both casts does it fail...
Ok, I think I see what is going on. "(rwlock_t) { { 1 }, 0
> > -8<---
> > /* compile with gcc -c foo.c */
> >
> > typedef struct {
> > volatile unsigned int lock;
> > } spinlock_t;
> >
> > typedef struct {
> > spinlock_t lock;
> > volatile int counter;
> > } rwlock_t;
> >
> > void foo(void)
> The following piece of code compiles with gcc-3.0 but not with
> gcc-3.2... is this a gcc bug? or is the code broken?
I would say the later.
> [EMAIL PROTECTED]:~$ gcc-3.2 -c t.c
> t.c: In function `foo':
> t.c:12: initializer element is not constant
>
> (it's a simplified example of some code
The following piece of code compiles with gcc-3.0 but not with
gcc-3.2... is this a gcc bug? or is the code broken?
[EMAIL PROTECTED]:~$ gcc-3.2 -c t.c
t.c: In function `foo':
t.c:12: initializer element is not constant
(it's a simplified example of some code from the parisc-linux kernel)
--
4 matches
Mail list logo