From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 15A5E3858D38; Mon, 23 Jan 2023 15:48:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15A5E3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674488926; bh=hwgwDIv024d/2KYYqe+O/fNt+cZHaTRmQS05raD3+N8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ngG5ri3JSD3LT5BQF7+JBkD18qvtBloO5cC6E7zJTJzu1AKzsQNcois2O5E7QTRTt qYLw4VXXDZ7IegAi04btAZ/xMwJws5acmYZ6+TZldD+JLqXJv2wo4BfhTt+jzmmMzK VpXUcJBrhYj0+25SuXgWtpPGffxtwcdlH3edboXc= From: "kungfujesus06 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108498] ppc64 big endian generates uninitialized reads with -fstore-merging Date: Mon, 23 Jan 2023 15:48:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kungfujesus06 at gmail dot com 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: 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 #6 from Adam Stylinski --- (In reply to Richard Biener from comment #5) > maybe a stack sharing issue? Can you try -fstack-reuse=3Dnone? So that does fix it, at least when the struct is backed by the stack. And = also valgrind is no longer finding uninitialized memory being used: adam@g5box ~ $ gcc -O2 -fstack-reuse=3Dnone bug_rep2.c -o test.out adam@g5box ~ $ ./test.out=20 sat? =3D 0 adam@g5box ~ $ valgrind ./test.out =3D=3D26982=3D=3D Memcheck, a memory error detector =3D=3D26982=3D=3D Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward = et al. =3D=3D26982=3D=3D Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyr= ight info =3D=3D26982=3D=3D Command: ./test.out =3D=3D26982=3D=3D=20 sat? =3D 0 =3D=3D26982=3D=3D=20 =3D=3D26982=3D=3D HEAP SUMMARY: =3D=3D26982=3D=3D in use at exit: 0 bytes in 0 blocks =3D=3D26982=3D=3D total heap usage: 1 allocs, 1 frees, 1,024 bytes alloca= ted =3D=3D26982=3D=3D=20 =3D=3D26982=3D=3D All heap blocks were freed -- no leaks are possible =3D=3D26982=3D=3D=20 =3D=3D26982=3D=3D For lists of detected and suppressed errors, rerun with: = -s =3D=3D26982=3D=3D ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 fr= om 0) Not sure what it might do if backed by the heap, but the code is written in= a way that it initializes the struct on the stack, anyway.=