public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47772] New: warnings from -Wmissing-field-initializers contradict documentation
@ 2011-02-16 20:49 darren at kulp dot ch
2011-02-16 21:08 ` [Bug c/47772] " darren at kulp dot ch
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: darren at kulp dot ch @ 2011-02-16 20:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47772
Summary: warnings from -Wmissing-field-initializers contradict
documentation
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: darren@kulp.ch
Created attachment 23367
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23367
testcase re: -Wmissing-field-initializers and designated initializers
According to gcc(1):
-Wmissing-field-initializers
Warn if a structure's initializer has some fields missing. ... This
option does not warn about designated initializers ....
This I find normally to be true. Attached is a test case that produces the
following warning on GCC 4.2.1, 4.4.4., and 4.5.2:
$ gcc -save-temps -Wmissing-field-initializers -c test3.c
test3.c:14: warning: missing initializer
test3.c:14: warning: (near initialization for ‘(anonymous)[0].b’)
If the `b' field is initialized either before or after the `a' field, the
warning disappears, but this should not be necessary, according to the
documentation.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/47772] warnings from -Wmissing-field-initializers contradict documentation
2011-02-16 20:49 [Bug c/47772] New: warnings from -Wmissing-field-initializers contradict documentation darren at kulp dot ch
@ 2011-02-16 21:08 ` darren at kulp dot ch
2011-02-21 17:03 ` webmaster@sky-siteweb.com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: darren at kulp dot ch @ 2011-02-16 21:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47772
--- Comment #1 from Darren Kulp <darren at kulp dot ch> 2011-02-16 20:58:17 UTC ---
Here is the output of `gcc -v' on the one system to which I have direct access:
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5646~6/src/configure --disable-checking
--enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
--build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
--program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10
--target=i686-apple-darwin10
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5646)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/47772] warnings from -Wmissing-field-initializers contradict documentation
2011-02-16 20:49 [Bug c/47772] New: warnings from -Wmissing-field-initializers contradict documentation darren at kulp dot ch
2011-02-16 21:08 ` [Bug c/47772] " darren at kulp dot ch
@ 2011-02-21 17:03 ` webmaster@sky-siteweb.com
2012-04-18 13:00 ` vadmium+gc at gmail dot com
2012-04-18 13:27 ` manu at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: webmaster@sky-siteweb.com @ 2011-02-21 17:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47772
Jonathan 'Sky' Squirawski <webmaster@sky-siteweb.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |webmaster@sky-siteweb.com
--- Comment #2 from Jonathan 'Sky' Squirawski <webmaster@sky-siteweb.com> 2011-02-21 16:55:39 UTC ---
I've the same problem with gcc 4.5.2.
Here another test case:
/*==================================*/
typedef struct bar_t {
int a;
int b;
} bar_t;
typedef struct foo_ok_t {
int bar;
bar_t foo;
} foo_ok_t;
typedef struct foo_nok_t {
bar_t bar;
bar_t foo;
} foo_nok_t;
int main(void) {
foo_ok_t foo_ok;
foo_nok_t foo_nok;
foo_ok = (foo_ok_t){
.bar = 32,
};
foo_nok = (foo_nok_t){
.bar = (bar_t){ .a = 32, .b = 42 },
};
return 0;
}
/*==================================*/
The first assignment doesn't trigger any warning, but the second one gives:
test.c:29:5: warning: missing initializer
test.c:29:5: warning: (near initialization for ‘(anonymous).foo’)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/47772] warnings from -Wmissing-field-initializers contradict documentation
2011-02-16 20:49 [Bug c/47772] New: warnings from -Wmissing-field-initializers contradict documentation darren at kulp dot ch
2011-02-16 21:08 ` [Bug c/47772] " darren at kulp dot ch
2011-02-21 17:03 ` webmaster@sky-siteweb.com
@ 2012-04-18 13:00 ` vadmium+gc at gmail dot com
2012-04-18 13:27 ` manu at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: vadmium+gc at gmail dot com @ 2012-04-18 13:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47772
Marty <vadmium+gc at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vadmium+gc at gmail dot com
--- Comment #3 from Marty <vadmium+gc at gmail dot com> 2012-04-18 12:30:44 UTC ---
Possibly related: Bug 36446, Bug 47772
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/47772] warnings from -Wmissing-field-initializers contradict documentation
2011-02-16 20:49 [Bug c/47772] New: warnings from -Wmissing-field-initializers contradict documentation darren at kulp dot ch
` (2 preceding siblings ...)
2012-04-18 13:00 ` vadmium+gc at gmail dot com
@ 2012-04-18 13:27 ` manu at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-18 13:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47772
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |manu at gcc dot gnu.org
Resolution| |DUPLICATE
--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-18 13:23:42 UTC ---
Duplicated. See my comments in PR36446.
*** This bug has been marked as a duplicate of bug 36446 ***
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-18 13:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-16 20:49 [Bug c/47772] New: warnings from -Wmissing-field-initializers contradict documentation darren at kulp dot ch
2011-02-16 21:08 ` [Bug c/47772] " darren at kulp dot ch
2011-02-21 17:03 ` webmaster@sky-siteweb.com
2012-04-18 13:00 ` vadmium+gc at gmail dot com
2012-04-18 13:27 ` manu at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).