This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/76733] New: GCC should warn on repeated initializer for same array element / struct member.
- From: "rusty at rustcorp dot com.au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 15 Aug 2016 04:57:11 +0000
- Subject: [Bug c/76733] New: GCC should warn on repeated initializer for same array element / struct member.
- Authentication-results: sourceware.org; auth=none
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=76733
Bug ID: 76733
Summary: GCC should warn on repeated initializer for same array
element / struct member.
Product: gcc
Version: 5.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: rusty at rustcorp dot com.au
Target Milestone: ---
Hit a nasty cut & paste bug in my code (extra comma before +3):
int x[] = { [0] = 1, +3, [1] = 1 };
This double-initialization of x[1] should cause a warning. Similarly:
struct s { int a, b; } s = { .a = 1, .a = 2};
Thanks!