Re: Bug with compound literal initializer?

2015-03-25 Thread Martin Sebor
On 03/24/2015 03:26 PM, Alexey Neyman wrote: Hi, I am seeing a strange behavior when a compound initializer is used in a structure initialization. A test case: [[[ struct s { int y; unsigned long *x; }; struct s foo = { .y = 25, .x = (unsigned long [SZ]){}, }; ]]] If SZ

Re: Bug with compound literal initializer?

2015-03-25 Thread Martin Sebor
Regarding undefined behavior: this object has static storage, so I think 6.7.9-10 from C11 should apply: Strictly speaking, once the behavior of a program is undefined, even well-defined constructs can have unexpected effects. But I do agree that dropping initialization for members with a valid

Re: Bug with compound literal initializer?

2015-03-25 Thread Alexey Neyman
On 03/25/2015 10:09 AM, Martin Sebor wrote: On 03/24/2015 03:26 PM, Alexey Neyman wrote: Hi, I am seeing a strange behavior when a compound initializer is used in a structure initialization. A test case: [[[ struct s { int y; unsigned long *x; }; struct s foo = { .y = 25,

Re: Bug with compound literal initializer?

2015-03-25 Thread Jonathan Wakely
On 25 March 2015 at 18:53, Martin Sebor wrote: This was my mistake because specifying -ansi after -std=c11 overrides the latter with -std=c90. (It would be nice if the driver warned about one option overriding another.) In general that's useful, so you can add e.g. -O0 to the end of a command