Bug 20209 - [4.0 Regression] Missing warnings for "aggregate has a partly bracketed initializer"
Summary: [4.0 Regression] Missing warnings for "aggregate has a partly bracketed initi...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2005-02-25 15:02 UTC by Andrew Pinski
Modified: 2007-01-21 21:52 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.2.3 4.1.0 4.1.1 4.1.2 4.2.0
Known to fail: 3.3.3 3.4.0 4.0.0
Last reconfirmed: 2006-01-14 04:54:31


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-02-25 15:02:12 UTC
The following should have warnings:
struct S { char a[6]; int b[2]; };

S S0 = { { "hello" }, { 1, 2 } };
S S1 = { { "hello" }, 1, 2 }; // { dg-warning "" }
S S2 = { "hello", { 1, 2 } };
S S3 = { "hello", 1, 2 }; // { dg-warning "" }
Comment 1 Andrew Pinski 2005-02-25 15:04:19 UTC
Obviously I compiled with "-W -Wall".
I wonder how this regression was missed for so long.
Comment 2 Jakub Jelinek 2005-02-25 16:38:02 UTC
Yeah, caused by addition of reshape_init.
Bigger testcase:

// PR c++/20209
// { dg-do compile }
// { dg-options "-Wmissing-braces" }

struct S { char a[6]; int b[2]; };
struct T { int a; int b[2]; };
struct U { int a; T b; };
struct V { char a[6]; int b[2]; int c; };
struct W { int a; int b[2]; int c; };
struct X { int a; W b; int c; };

S a = { { "hello" }, { 1, 2 } };
S b = { { "hello" }, 1, 2 };    // { dg-warning "" }
S c = { "hello", { 1, 2 } };
S d = { "hello", 1, 2 };        // { dg-warning "" }
T e = { 1, { 2, 3 } };
T f = { 1, 2, 3 };              // { dg-warning "" }
U g = { 1, { 2, { 3, 4 } } };
U h = { 1, 2, { 3, 4 } };       // { dg-warning "" }
U i = { 1, 2, 3, 4 };           // { dg-warning "" }
V j = { { "hello" }, { 1, 2 }, 3 };
V k = { { "hello" }, 1, 2, 3 }; // { dg-warning "" }
V l = { "hello", { 1, 2 }, 3 };
V m = { "hello", 1, 2, 3 };     // { dg-warning "" }
W n = { 1, { 2, 3 }, 4 };
W o = { 1, 2, 3, 4 };           // { dg-warning "" }
X p = { 1, { 2, { 3, 4 }, 5 }, 6 };
X q = { 1, 2, { 3, 4 }, 5, 6 }; // { dg-warning "" }
X r = { 1, 2, 3, 4, 5, 6 };     // { dg-warning "" }
Comment 3 Andrew Pinski 2005-03-01 01:22:27 UTC
: Search converges between 2002-10-15-trunk (#105) and 2002-10-16-trunk (#106).
Comment 4 Andrew Pinski 2005-03-08 02:32:10 UTC
: Search converges between 2002-10-15-trunk (#105) and 2002-10-16-trunk (#106).
Comment 5 Andrew Pinski 2005-07-22 21:13:32 UTC
Moving to 4.0.2 pre Mark.
Comment 6 Andrew Pinski 2005-10-15 19:43:50 UTC
Fixed at least on the mainline.
Comment 7 Gabriel Dos Reis 2007-01-18 03:37:25 UTC
won't fix for GCC-4.0.x
Comment 8 Andrew Pinski 2007-01-21 21:52:48 UTC
Fixed.