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 middle-end/95810] Spurious UBSan warning when computing the opposite of the absolute value of INT_MIN
Date: Wed, 24 Jun 2020 08:41:17 +0000	[thread overview]
Message-ID: <bug-95810-4-uFWXKmbztU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95810-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from CVS 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:01e10b0ee77e82cb331414c569e02dc7a2c4999e

commit r11-1620-g01e10b0ee77e82cb331414c569e02dc7a2c4999e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jun 24 10:40:02 2020 +0200

    fold-const: Fix A <= 0 ? A : -A folding [PR95810]

    We folded A <= 0 ? A : -A into -ABS (A), which is for signed integral types
    incorrect - can invoke on INT_MIN UB twice, once on ABS and once on its
    negation.

    The following patch fixes it by instead folding it to (type)-ABSU (A).

    2020-06-24  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/95810
            * fold-const.c (fold_cond_expr_with_comparison): Optimize
            A <= 0 ? A : -A into (type)-absu(A) rather than -abs(A).

            * gcc.dg/ubsan/pr95810.c: New test.

  parent reply	other threads:[~2020-06-24  8:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22  7:52 [Bug tree-optimization/95810] New: " felix.von.s at posteo dot de
2020-06-22  8:51 ` [Bug middle-end/95810] " pinskia at gcc dot gnu.org
2020-06-22  9:36 ` jakub at gcc dot gnu.org
2020-06-22  9:53 ` jakub at gcc dot gnu.org
2020-06-24  8:41 ` cvs-commit at gcc dot gnu.org [this message]
2020-09-16 19:22 ` cvs-commit at gcc dot gnu.org
2021-04-28 17:56 ` [Bug middle-end/95810] [8 only] " pinskia at gcc dot gnu.org
2021-05-14 14:02 ` jakub at gcc dot gnu.org

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-95810-4-uFWXKmbztU@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).