From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2007D3858D1E; Tue, 24 Jan 2023 12:55:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2007D3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674564940; bh=buDZVl1utqvebhtP0NIZoceaTXVQyUdjra4RKsQSgfY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iCfgeDv2q9JahNNfR30WR1qks0N439k+ncAVU2mjWv+zu8RSoGElbrQQvHyU2IQJD c/azpiKxWxswDt2+v1m/IHRvkrOGlS5diiG2r2KxCS2uHdGOi3HCBFQwoIZsFBxisY WLd1g/OMbXYW2+P63LzbOvKTFfBx0l/bfg31xMvI= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108498] [11/12/13 Regression] ppc64 big endian generates uninitialized reads with -fstore-merging Date: Tue, 24 Jan 2023 12:55:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108498 --- Comment #18 from Jakub Jelinek --- Slightly adjusted testcase for -O2 which actually aborts at runtime quite reliably: struct A { signed char a1; int a2; }; struct B { struct A b1; unsigned char b2:1, b3:1, b4:2, b5:1, b6:1, b7[4]; }; struct C { unsigned char c1; char c2; signed char c3; unsigned char c4, c5[4], c6:1, c7:1, c8:1, c9:3, c10:1; struct A c11; struct B c12[3]; }; static inline struct C foo (unsigned char a, unsigned b, int c, struct A d, unsigned e, struct B f, struct B g, struct B h) { struct C x =3D { .c1 =3D b, .c2 =3D 0, .c3 =3D c, .c6 =3D a, .c4 =3D e, .c7 =3D 0, .c8 =3D 0, .c9 =3D 7, .c10 =3D 0, .c5 =3D {0, 1, 2, 3}, .c11 =3D d, .c12 =3D {f, g, h} }; return x; } static inline struct A bar (int a, int b) { struct A x =3D { .a1 =3D a, .a2 =3D b }; return x; } static inline struct B baz (struct A b1) { struct B x =3D { .b1 =3D b1, .b6 =3D 0, .b5 =3D 0, .b7 =3D {0, 1, 2, 3}, = .b2 =3D 0 }; return x; } struct C qux (void) { const struct B a =3D baz (bar (0, 0)); struct C b; struct B c[2]; struct A d =3D { 0, 1 }; c[0].b1.a1 =3D 0; c[0].b1.a2 =3D 2; c[1].b1.a1 =3D 4; c[1].b1.a2 =3D 8; return foo (0, 2, -1, d, 3, c[0], c[1], a); } __attribute__((noipa)) void corge (struct C *x) { char buf[1024]; __builtin_memset (buf, 0xaa, sizeof (buf)); asm volatile ("" : : "r" (buf)); __builtin_memset (x, 0x55, sizeof (struct C)); asm volatile ("" : : "r" (x)); } int main () { struct C x; corge (&x); x =3D qux (); if (x.c6 || x.c9 !=3D 7) __builtin_abort (); }=