[Bug c/60257] New: Incorrect column number and confusing message in -Woverride-init
chengniansun at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 18 05:53:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60257
Bug ID: 60257
Summary: Incorrect column number and confusing message in
-Woverride-init
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: chengniansun at gmail dot com
I have two questions regarding -Woverride-init,
1) the column number seems not right
always starting from the beginning of the statement.
2) the second message is confusing to me.
is it trying to pinpoint the location where the field is first
initialized, similar to what Clang does?
$: cat s.c
struct S {int i; int j;};
struct S s = {
.j=4, .i=5, .i=6,
};
$: gcc-trunk -std=c99 -c -Woverride-init s.c
s.c:3:3: warning: initialized field overwritten [-Woverride-init]
.j=4, .i=5, .i=6,
^
s.c:3:3: warning: (near initialization for ‘s.i’) [-Woverride-init]
$: clang-trunk -std=c99 -Winitializer-overrides -c s.c
s.c:3:18: warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
.j=4, .i=5, .i=6,
^
s.c:3:12: note: previous initialization is here
.j=4, .i=5, .i=6,
^
1 warning generated.
More information about the Gcc-bugs
mailing list