From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B02AB3858282; Wed, 27 Mar 2024 18:39:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B02AB3858282 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711564766; bh=DpEV99F8edKOZyMkQ+eIpWLIhcNRVGvxx6nBDQujxvA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lb6qrDF93TMrcXbvnMZ/L4LlVnl5vAQX1mtnqWU2cl93M9shNQpBEaTE7d3mz/L2O L4vZLCnUNX4YCCjeRn7ut+SlsSbmXE2aVT8xSE8plYsd+puGnLff/ckSDWE1HAyXrm Oiv62GWzlKZFO/ldf3h07UL3KF76Z49uCWdn2MFU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114469] gcc.dg/torture/bitint-64.c failure with -O2 -flto -std=c23 -fwrapv Date: Wed, 27 Mar 2024 18:39:25 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit 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: 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=3D114469 --- Comment #2 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:4b0443361a82ef89d519c9ae6d4d3bec74376e8f commit r14-9694-g4b0443361a82ef89d519c9ae6d4d3bec74376e8f Author: Jakub Jelinek Date: Wed Mar 27 19:38:06 2024 +0100 c-family: Cast __atomic_load_*/__atomic_exchange_* result to _BitInt ra= ther then VCE it [PR114469] As written in the PR, torture/bitint-64.c test fails with -O2 -flto and the reason is that on _BitInt arches where the padding bits are undefined, the padding bits in the _Atomic vars are also undefined, but when __atomic_load or __atomic_exchange on a _BitInt _Atomic variab= le with some padding bits is lowered into __atomic_load_{1,2,4,8,16} or __atomic_exchange_*, the mode precision unsigned result is VIEW_CONVERT_EXPR converted to _BitInt and because of the VCE nothing actually sign/zero extends it as needed for later uses - the var is no longer addressable = and expansion assumes such automatic vars are properly extended. The following patch fixes that by using NOP_EXPR on it (the VIEW_CONVERT_EXPR after it will then be optimized away during gimplification, didn't want to repeat it in the code as else result =3D build1 (VIEW_CONVERT_EXPR, ...); twice. 2024-03-27 Jakub Jelinek PR tree-optimization/114469 * c-common.cc (resolve_overloaded_builtin): For _BitInt result on !extended targets convert result to the _BitInt type before using VIEW_CONVERT_EXPR.=