From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 23969381DCF6; Thu, 19 Mar 2020 15:31:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23969381DCF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1584631904; bh=rhnYSpBi9v9+jrrRzCQRVdDfzM4DbEOKF9tfeiqbYdQ=; h=From:To:Subject:Date:From; b=VLixw9AmlhlrcoTXDQEu+NMM0RO1pnFA4pail2izn0hTYI/xZFWepl919OxFrapNU vlnZAzFL0YaPspELHJHJsUpA8mMlNQFXpVr8WP4Bmza0A8Tz5d/dNHWD2E30MuboTr thn3RxNGSYgBFIcex2q5ThQuZ9ROPpoWzYsJmT4U= From: "dje at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/94225] New: C18 conformance for structure implicit initialization Date: Thu, 19 Mar 2020 15:31:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: dje at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2020 15:31:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94225 Bug ID: 94225 Summary: C18 conformance for structure implicit initialization Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dje at gcc dot gnu.org Target Milestone: --- Example 12 in section 6.7.9 of the C18 standard demonstrates that implicit initialization does not override prior explicit initialization. The follow= ing is the example code with error checking added. $ cat example12.c #include struct T { int k; int l; }; struct S { int i; struct T t; }; struct T x =3D {.l =3D 43, .k =3D 42, }; int main(void) { struct S l =3D { 1, .t =3D x, .t.l =3D 41, }; if (l.t.k !=3D 42) fprintf(stderr, "l.t.k is %d instead of 42\n", l.t.k); } $ ./xgcc -B./ -std=3Dgnu1x example12.c $ ./a.out l.t.k is 0 instead of 42 $=