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 c++/101443] [9/10/11 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
Date: Sun, 18 Jul 2021 23:29:18 +0000	[thread overview]
Message-ID: <bug-101443-4-33Tl88RHc5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101443-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:2f49122aec76fdd40a7157f66df9c058d635efe6

commit r11-8772-g2f49122aec76fdd40a7157f66df9c058d635efe6
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jul 15 18:53:20 2021 +0200

    c++: Optimize away NULLPTR_TYPE comparisons [PR101443]

    Comparisons of NULLPTR_TYPE operands cause all kinds of problems in the
    middle-end and in fold-const.c, various optimizations assume that if they
    see e.g. a non-equality comparison with one of the operands being
    INTEGER_CST and it is not INTEGRAL_TYPE_P (which has TYPE_{MIN,MAX}_VALUE),
    they can build_int_cst (type, 1) to find a successor.

    The following patch fixes it by making sure they don't appear in the IL,
    optimize them away at cp_fold time as all can be folded.

    Though, I've just noticed that clang++ rejects the non-equality comparisons
    instead, foo () > 0 with
    invalid operands to binary expression ('decltype(nullptr)' (aka
'nullptr_t') and 'int')
    and foo () > nullptr with
    invalid operands to binary expression ('decltype(nullptr)' (aka
'nullptr_t') and 'nullptr_t')

    Shall we reject those too, in addition or instead of parts of this patch?
    If so, wouldn't this patch be still useful for backports, I bet we don't
    want to start reject it on the release branches when we used to accept it.

    2021-07-15  Jakub Jelinek  <jakub@redhat.com>

            PR c++/101443
            * cp-gimplify.c (cp_fold): For comparisons with NULLPTR_TYPE
            operands, fold them right away to true or false.

            * g++.dg/cpp0x/nullptr46.C: New test.

    (cherry picked from commit 7094a69bd62a14dfa311eaa2fea468f221c7c9f3)

  parent reply	other threads:[~2021-07-18 23:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 19:43 [Bug c++/101443] New: " rawiener at amazon dot com
2021-07-13 20:04 ` [Bug c++/101443] " pinskia at gcc dot gnu.org
2021-07-13 20:29 ` rawiener at amazon dot com
2021-07-13 21:07 ` pinskia at gcc dot gnu.org
2021-07-14  9:13 ` jakub at gcc dot gnu.org
2021-07-14 10:18 ` jakub at gcc dot gnu.org
2021-07-14 10:22 ` [Bug c++/101443] [9/10/11/12 Regression] " jakub at gcc dot gnu.org
2021-07-15 16:54 ` cvs-commit at gcc dot gnu.org
2021-07-15 16:55 ` [Bug c++/101443] [9/10/11 " jakub at gcc dot gnu.org
2021-07-18 23:29 ` cvs-commit at gcc dot gnu.org [this message]
2021-07-19  7:55 ` [Bug c++/101443] [9/10 " jakub at gcc dot gnu.org
2022-05-10  8:19 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:21 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:36 ` jakub at gcc dot gnu.org
2024-02-27 16:16 ` rawiener at amazon dot com

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-101443-4-33Tl88RHc5@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).