[bugs] Re: GCC problem (Was: Re: [bugs] Problem compiling the kernel)
Andreas Jaeger
aj@suse.de
Mon Dec 10 07:52:00 GMT 2001
"Joseph S. Myers" <jsm28@cam.ac.uk> writes:
> On Mon, 10 Dec 2001, Bo Thorsen wrote:
>
>> typedef struct { } spinlock_t;
>> spinlock_t runqueue_lock
>> __attribute__((__aligned__((1 << ((6)))),
>> __section__(".data.cacheline_aligned"))) = (spinlock_t) { };
>>
>> ----- problem.c -----
>>
>> > ../crossbuild/x86-64/bin/x86_64-unknown-linux-gcc problem.c
>> problem.c:4: initializer element is not constant
>>
>> ia32 gcc works fine.
>>
>> Ideas on how this has come to be?
>
> No-one spoke up in favour of this extension (treating compound literals as
> if they were the brace-enclosed lists they contain) when I asked
> <URL:http://gcc.gnu.org/ml/gcc/2001-11/msg01161.html>, so I killed it when
Seems that nobody noticed this.:-( The Linux kernel relies on this
(that's where the example is from) and it seems to work with GCC
2.95.x and GCC 3.0 also.
> implementing proper C99 semantics for compound literals. A compound
> literal, as an expression here of structure type, is not a valid
> initializer for an object of static storage duration.
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
More information about the Gcc
mailing list