This is the mail archive of the
mailing list for the GCC project.
Re: Bug with compound literal initializer?
- From: Martin Sebor <msebor at redhat dot com>
- To: Alexey Neyman <stilor at att dot net>, gcc at gcc dot gnu dot org
- Date: Wed, 25 Mar 2015 12:53:52 -0600
- Subject: Re: Bug with compound literal initializer?
- Authentication-results: sourceware.org; auth=none
- References: <5511D668 dot 5060009 at att dot net> <5512EBB0 dot 4070601 at redhat dot com> <5512FC1F dot 6030201 at att dot net>
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
(i.e., non-zero sized aggregate) initializer is likely a bug.
(GCC does allow empty initializer-lists as a (useful) extension
independent of zero-size arrays and I don't think that's the
source of the problem here.)
Isn't it strange that C90 warnings are emitted in presence of -std=c11?
I don't get these C90 warnings with 4.9.1 if I specify -std=c99 or
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.)