public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519
@ 2021-07-13 19:43 rawiener at amazon dot com
  2021-07-13 20:04 ` [Bug c++/101443] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: rawiener at amazon dot com @ 2021-07-13 19:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101443
           Summary: internal compiler error: in wide_int_to_tree_1, at
                    tree.c:1519
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rawiener at amazon dot com
  Target Milestone: ---

Created attachment 51147
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51147&action=edit
tar containg ss and ii files

Hey,
I use g++ 9.3 and got this error. I checked with godbolt.org and bug exists on
trunk as well.

gcc version:
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

compiled with:
g++ -v -save-temps -O2 -Wno-multichar -Wall -Wextra bug.cpp

when compiling with O0 compilation succeeded.

output
during GIMPLE pass: dom
bug.cpp: In function 'int main()':
bug.cpp:105:5: internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  105 | int main() {

attached s and ii files inside the bz2 file.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
@ 2021-07-13 20:04 ` pinskia at gcc dot gnu.org
  2021-07-13 20:29 ` rawiener at amazon dot com
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-13 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-07-13
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
#6  0x000000000085567e in wide_int_to_tree_1 (type=0x7ffff6cd9bd0, pcst=...) at
/home/apinski/src/upstream-gcc-git/gcc/gcc/tree.c:1751
1751              gcc_unreachable ();
(gdb) l
1746
1747            case ENUMERAL_TYPE:
1748              break;
1749
1750            default:
1751              gcc_unreachable ();
1752            }
1753
1754          if (ix >= 0)
1755            {
(gdb) p type
$1 = (tree) 0x7ffff6cd9bd0
(gdb) p debug_tree(type)
 <nullptr_type 0x7ffff6cd9bd0 decltype(nullptr) sizes-gimplified unsigned
type_6 DI
    size <integer_cst 0x7ffff6b77ed0 type <integer_type 0x7ffff6b950a8
bitsizetype> constant 64>
    unit-size <integer_cst 0x7ffff6b77ee8 type <integer_type 0x7ffff6b95000
sizetype> constant 8>
    align:64 warn_if_not_align:0 symtab:0 alias-set 46 canonical-type
0x7ffff6cd9bd0
    pointer_to_this <pointer_type 0x7ffff44910a8> reference_to_this
<reference_type 0x7ffff448adc8>>

nullptr_type seems a bit off here.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 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
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rawiener at amazon dot com @ 2021-07-13 20:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Rafi Wiener <rawiener at amazon dot com> ---
Hey I just found that if I wrap the lines

template<typename T>
struct  pchar2string {
    static T    cast(T& t) {return t;}
};

with those pragma to disable optimization it works.
#pragma GCC push_options
#pragma GCC optimize ("O0")

#pragma GCC pop_options

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 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
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-13 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
  _93 = MEM[(<<< Unknown tree: nullptr_type >>> &)_84 + 32];
  _94 = MEM[(<<< Unknown tree: nullptr_type >>> &)__res$second_88 + 32];
  _81 = _93 < _94;

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (2 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-14  9:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase for -O2:
template <typename a> struct e { a c; };
template <typename d> struct f { void operator()(d g, d h) { g < h; } };
template <unsigned long, typename> struct n;
template <long i, typename d> using j = typename n<i, d>::k;
template <typename...> class ah {};
template <unsigned long i, typename ag, typename... l>
struct n<i, ah<ag, l...>> : n<i - 1, ah<l...>> {};
template <typename ag, typename... l> struct n<0, ah<ag, l...>> { typedef ag k;
};
template <int i, typename... ai> j<i, ah<ai...>> aj(ah<ai...>);
template <typename m, int i> struct o { static bool am(int g, m h) { 0 <
aj<i>(h) || o<m, 1>::am(g, h); return false; } };
template <typename... ap, typename... aq> void operator<(ah<ap...>, ah<aq...>)
{
  using ar = o<ah<aq...>, 0>;
  ar::am;
}
template <typename... ai> ah<ai...> as(ai...);
template <typename d> struct F { d operator*(); };
template <typename av> struct p { typedef F<av> ay; };
template <typename az, typename ba = f<az>> struct q {
  void operator[](az g) { typename p<e<az>>::ay i; bh()(g, (*i).c); }
  ba bh();
};
struct r {
  template <typename... bj> static int aj(bj... g) {
    auto a = as(g...);
    using bc = decltype(a);
    q<bc> b;
    b[a];
    return 0;
  }
  template <typename... bj> static int bn(bj... g) { aj(g...); return 0; }
};
int main() { r::bn(0, nullptr); }

Even simpler testcase:
decltype(nullptr) foo ();
bool bar () { return 0 < foo () || foo () < 0; }

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (3 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-14 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 51148
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51148&action=edit
gcc12-pr101443.patch

Untested fix.  I think it is best to optimize away these comparisons, as
NULLPTR_TYPE has only one possible value, we can always determine the result,
==, <= and >= will be always true and !=, < and > will be always false.
And keeping it around in the IL can break various optimizations, e.g. the range
stuff (in fold-const and reassoc), or dom, anything that will try to
build_int_cst 1 or -1 or something similar when it sees a comparison of
something with INTEGER_CST.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] [9/10/11/12 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (4 preceding siblings ...)
  2021-07-14 10:18 ` jakub at gcc dot gnu.org
@ 2021-07-14 10:22 ` jakub at gcc dot gnu.org
  2021-07-15 16:54 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-14 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5
            Summary|internal compiler error: in |[9/10/11/12 Regression]
                   |wide_int_to_tree_1, at      |internal compiler error: in
                   |tree.c:1519                 |wide_int_to_tree_1, at
                   |                            |tree.c:1519
           Keywords|needs-bisection             |

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On the small testcase started with
r0-117521-gec62cbe19bf3a8ff16a33f7b3026f25faf93e25c

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] [9/10/11/12 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (5 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-15 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:7094a69bd62a14dfa311eaa2fea468f221c7c9f3

commit r12-2331-g7094a69bd62a14dfa311eaa2fea468f221c7c9f3
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.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] [9/10/11 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (6 preceding siblings ...)
  2021-07-15 16:54 ` cvs-commit at gcc dot gnu.org
@ 2021-07-15 16:55 ` jakub at gcc dot gnu.org
  2021-07-18 23:29 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-15 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11/12 Regression]     |[9/10/11 Regression]
                   |internal compiler error: in |internal compiler error: in
                   |wide_int_to_tree_1, at      |wide_int_to_tree_1, at
                   |tree.c:1519                 |tree.c:1519

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.  The accepts-invalid case is already tracked in
PR99701

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] [9/10/11 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (7 preceding siblings ...)
  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
  2021-07-19  7:55 ` [Bug c++/101443] [9/10 " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-18 23:29 UTC (permalink / raw)
  To: gcc-bugs

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)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] [9/10 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (8 preceding siblings ...)
  2021-07-18 23:29 ` cvs-commit at gcc dot gnu.org
@ 2021-07-19  7:55 ` jakub at gcc dot gnu.org
  2022-05-10  8:19 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-19  7:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11 Regression]        |[9/10 Regression] internal
                   |internal compiler error: in |compiler error: in
                   |wide_int_to_tree_1, at      |wide_int_to_tree_1, at
                   |tree.c:1519                 |tree.c:1519

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11.2 too.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] [9/10 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (9 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-10  8:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r10-10632-g2adeae7ab5f7bd274f3dda58baa04710699e59be
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)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] [9/10 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (10 preceding siblings ...)
  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
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-11  6:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:c910d7919529b490098319ab84c5c0132e8809f0

commit r9-10089-gc910d7919529b490098319ab84c5c0132e8809f0
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)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] [9/10 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (11 preceding siblings ...)
  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
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-11  6:36 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c++/101443] [9/10 Regression] internal compiler error: in wide_int_to_tree_1, at tree.c:1519
  2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 rawiener at amazon dot com
                   ` (12 preceding siblings ...)
  2022-05-11  6:36 ` jakub at gcc dot gnu.org
@ 2024-02-27 16:16 ` rawiener at amazon dot com
  13 siblings, 0 replies; 15+ messages in thread
From: rawiener at amazon dot com @ 2024-02-27 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

Rafi Wiener <rawiener at amazon dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #14 from Rafi Wiener <rawiener at amazon dot com> ---
thanks

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-27 16:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13 19:43 [Bug c++/101443] New: internal compiler error: in wide_int_to_tree_1, at tree.c:1519 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
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

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).