From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 266F938708F0; Mon, 22 Feb 2021 17:10:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 266F938708F0 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/99207] #pragma pack(1) and __int128 lead to bad optimization under O2 and higher optimization Date: Mon, 22 Feb 2021 17:10:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: resolution cc bug_status 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 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: Mon, 22 Feb 2021 17:10:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99207 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID CC| |jakub at gcc dot gnu.org Status|UNCONFIRMED |RESOLVED --- Comment #1 from Jakub Jelinek --- That is a user error, don't do that. The fact that d doesn't point to properly aligned object needs to be visibl= e on the pointer dereference location, so you would need to use e.g. aligned(1) attribute on e.g. a typedef to __int128, e.g. typedef __int128 T __attribute__((aligned (1))); T *d =3D &c.b; Otherwise it is UB and -fsanitize=3Dundefined would have diagnosed it.=