public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-114469-4-yw6tCQHYW2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114469-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114469

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:4b0443361a82ef89d519c9ae6d4d3bec74376e8f

commit r14-9694-g4b0443361a82ef89d519c9ae6d4d3bec74376e8f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 27 19:38:06 2024 +0100

    c-family: Cast __atomic_load_*/__atomic_exchange_* result to _BitInt rather
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 variable
    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 =
build1
    (VIEW_CONVERT_EXPR, ...); twice.

    2024-03-27  Jakub Jelinek  <jakub@redhat.com>

            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.

      parent reply	other threads:[~2024-03-27 18:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 13:57 [Bug tree-optimization/114469] New: " jakub at gcc dot gnu.org
2024-03-25 18:19 ` [Bug tree-optimization/114469] " jsm28 at gcc dot gnu.org
2024-03-27 18:39 ` cvs-commit at gcc dot gnu.org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-114469-4-yw6tCQHYW2@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).