public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105912] New: internal compiler error: in extract_call_expr,  at cp/call.cc:7114
@ 2022-06-09 20:28 ldalessandro at gmail dot com
  2022-06-09 20:38 ` [Bug c++/105912] " ldalessandro at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ldalessandro at gmail dot com @ 2022-06-09 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105912
           Summary: internal compiler error: in extract_call_expr, at
                    cp/call.cc:7114
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

Created attachment 53113
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53113&action=edit
output from -freport-bug

ICE in complex constexpr/consteval context. I think this code is invalid.
Debian testing gcc-12.1.
-

[ 83%] Building CXX object tests/CMakeFiles/expressions.dir/expressions.cpp.o
/home/ldalessa/open/ttl/tests/expressions.cpp: In instantiation of ‘constexpr
bool contraction(ttl::utils::type_args<I>) [with T = int]’:
/home/ldalessa/open/ttl/tests/expressions.cpp:589:24:   required from
‘constexpr bool tests(ttl::utils::type_args<I>) [with T = int]’
/home/ldalessa/open/ttl/tests/expressions.cpp:600:19:   required from here
/home/ldalessa/open/ttl/tests/expressions.cpp:149:13: internal compiler error:
in extract_call_expr, at cp/call.cc:7114
  149 |   T dot = a(~i) * a(i);
      |             ^~
0x65a180 extract_call_expr(tree_node*)
        ../../src/gcc/cp/call.cc:7114
0x80b0cb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.cc:20971
0x819ea1 tsubst_copy_and_build_call_args
        ../../src/gcc/cp/pt.cc:19937
0x80ae60 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.cc:20687
0x80a6a7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.cc:20322
0x81b618 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:19491
0x822f79 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:16770
0x822f79 tsubst_init
        ../../src/gcc/cp/pt.cc:16774
0x81dc83 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:18643
0x81cb62 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:18462
0x81cb62 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:18476
0x81c158 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:18462
0x81c158 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:18833
0x81ab7c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:26412
0x81ab7c instantiate_body
        ../../src/gcc/cp/pt.cc:26412
0x81b439 instantiate_decl(tree_node*, bool, bool)
        ../../src/gcc/cp/pt.cc:26704
0x6d4962 cxx_eval_call_expression
        ../../src/gcc/cp/constexpr.cc:2664
0x6d6f68 cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.cc:6720
0x6d9011 cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.cc:6828
0x6d6ebe cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.cc:7044

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

* [Bug c++/105912] internal compiler error: in extract_call_expr, at cp/call.cc:7114
  2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
@ 2022-06-09 20:38 ` ldalessandro at gmail dot com
  2022-06-09 20:42 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ldalessandro at gmail dot com @ 2022-06-09 20:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Luke Dalessandro <ldalessandro at gmail dot com> ---
Somewhat reduced testcase:

    template <wchar_t> struct A {};
    template <wchar_t> struct B {};

    template <wchar_t a>
    static consteval auto operator~(A<a>) -> B<a> {
        return {};
    }

    A<'i'> i;

    template <class>
    auto test() -> bool {
        auto ii = ~i;      // ICE HERE
        return true;
    }

    int main()
    {
        bool i = test<int>();
    }

https://godbolt.org/z/rEf4neexc

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

* [Bug c++/105912] internal compiler error: in extract_call_expr, at cp/call.cc:7114
  2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
  2022-06-09 20:38 ` [Bug c++/105912] " ldalessandro at gmail dot com
@ 2022-06-09 20:42 ` mpolacek at gcc dot gnu.org
  2022-06-09 21:02 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-09 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2022-06-09
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thanks for the reduction, confirmed.

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

* [Bug c++/105912] internal compiler error: in extract_call_expr, at cp/call.cc:7114
  2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
  2022-06-09 20:38 ` [Bug c++/105912] " ldalessandro at gmail dot com
  2022-06-09 20:42 ` mpolacek at gcc dot gnu.org
@ 2022-06-09 21:02 ` mpolacek at gcc dot gnu.org
  2022-06-16 13:12 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-09 21:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The ICE started with r277733

commit f968ef9b8df2bc2287e5e7e87299e5a2a44e8c94
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Nov 2 00:28:20 2019 +0100

    PR c++/88335 - Implement P1073R3: Immediate functions

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

* [Bug c++/105912] internal compiler error: in extract_call_expr, at cp/call.cc:7114
  2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
                   ` (2 preceding siblings ...)
  2022-06-09 21:02 ` mpolacek at gcc dot gnu.org
@ 2022-06-16 13:12 ` marxin at gcc dot gnu.org
  2022-07-12 13:48 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-06-16 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #3)
> The ICE started with r277733
> 
> commit f968ef9b8df2bc2287e5e7e87299e5a2a44e8c94
> Author: Jakub Jelinek <jakub@redhat.com>
> Date:   Sat Nov 2 00:28:20 2019 +0100
> 
>     PR c++/88335 - Implement P1073R3: Immediate functions

@Marek: Please add to CC author of a revision you bisected to.

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

* [Bug c++/105912] internal compiler error: in extract_call_expr, at cp/call.cc:7114
  2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
                   ` (3 preceding siblings ...)
  2022-06-16 13:12 ` marxin at gcc dot gnu.org
@ 2022-07-12 13:48 ` ppalka at gcc dot gnu.org
  2022-07-13 18:03 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-07-12 13:48 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

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

* [Bug c++/105912] internal compiler error: in extract_call_expr, at cp/call.cc:7114
  2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
                   ` (4 preceding siblings ...)
  2022-07-12 13:48 ` ppalka at gcc dot gnu.org
@ 2022-07-13 18:03 ` cvs-commit at gcc dot gnu.org
  2022-07-13 18:05 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-13 18:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

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

commit r13-1688-gf70c18524221dcefa6cd26cee7b55503181bd912
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jul 13 14:02:08 2022 -0400

    c++: non-dependent call to consteval operator [PR105912]

    Here we're crashing when substituting a non-dependent call to a
    consteval operator, whose CALL_EXPR_OPERATOR_SYNTAX flag we try to
    propagate to the result, but the result isn't a CALL_EXPR since the
    selected function is consteval.  This patch fixes this by checking the
    result of extract_call_expr accordingly.  (Note that we can't check
    DECL_IMMEDIATE_FUNCTION_P here because we don't know which function was
    selected by overload resolution from here.)

            PR c++/105912

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Guard against
            NULL_TREE extract_call_expr result.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/consteval31.C: New test.

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

* [Bug c++/105912] internal compiler error: in extract_call_expr, at cp/call.cc:7114
  2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
                   ` (5 preceding siblings ...)
  2022-07-13 18:03 ` cvs-commit at gcc dot gnu.org
@ 2022-07-13 18:05 ` ppalka at gcc dot gnu.org
  2022-07-21 18:38 ` cvs-commit at gcc dot gnu.org
  2022-07-21 18:39 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-07-13 18:05 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.2

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

* [Bug c++/105912] internal compiler error: in extract_call_expr, at cp/call.cc:7114
  2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
                   ` (6 preceding siblings ...)
  2022-07-13 18:05 ` ppalka at gcc dot gnu.org
@ 2022-07-21 18:38 ` cvs-commit at gcc dot gnu.org
  2022-07-21 18:39 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-21 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

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

commit r12-8606-ga074ae297d5dbd69e03c6c30f9cb7720685fdb62
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Jul 21 12:59:44 2022 -0400

    c++: non-dependent call to consteval operator [PR105912]

    Here we're crashing when substituting a non-dependent call to a
    consteval operator, whose CALL_EXPR_OPERATOR_SYNTAX flag we try to
    propagate to the result, but the result isn't a CALL_EXPR since the
    selected function is consteval.  This patch fixes this by checking the
    result of extract_call_expr accordingly.  (Note that we can't check
    DECL_IMMEDIATE_FUNCTION_P here because we don't know which function was
    selected by overload resolution from here.)

            PR c++/105912

    gcc/cp/ChangeLog:

            * call.cc (extract_call_expr): Return a NULL_TREE on failure
            instead of asserting.
            * pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Guard against
            NULL_TREE extract_call_expr result.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/consteval31.C: New test.

    (cherry picked from commit f70c18524221dcefa6cd26cee7b55503181bd912)

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

* [Bug c++/105912] internal compiler error: in extract_call_expr, at cp/call.cc:7114
  2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
                   ` (7 preceding siblings ...)
  2022-07-21 18:38 ` cvs-commit at gcc dot gnu.org
@ 2022-07-21 18:39 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-07-21 18:39 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12.2/13

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

end of thread, other threads:[~2022-07-21 18:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 20:28 [Bug c++/105912] New: internal compiler error: in extract_call_expr, at cp/call.cc:7114 ldalessandro at gmail dot com
2022-06-09 20:38 ` [Bug c++/105912] " ldalessandro at gmail dot com
2022-06-09 20:42 ` mpolacek at gcc dot gnu.org
2022-06-09 21:02 ` mpolacek at gcc dot gnu.org
2022-06-16 13:12 ` marxin at gcc dot gnu.org
2022-07-12 13:48 ` ppalka at gcc dot gnu.org
2022-07-13 18:03 ` cvs-commit at gcc dot gnu.org
2022-07-13 18:05 ` ppalka at gcc dot gnu.org
2022-07-21 18:38 ` cvs-commit at gcc dot gnu.org
2022-07-21 18:39 ` ppalka at gcc dot gnu.org

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