public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97837] New: ICE on requires with *this in destructor
@ 2020-11-15 10:28 gccbugbjorn at fahller dot se
  2020-11-15 10:28 ` [Bug c++/97837] " gccbugbjorn at fahller dot se
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gccbugbjorn at fahller dot se @ 2020-11-15 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97837
           Summary: ICE on requires with *this in destructor
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gccbugbjorn at fahller dot se
  Target Milestone: ---

Created attachment 49560
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49560&action=edit
Preprocessed source of failing program

The following code causes an ICE with g++-10.2.0 (also with 20201114 on
CompilerExplorer)

#include <type_traits>

template <typename>
struct S
{
    ~S()
    requires(std::is_rvalue_reference(*this));
};

S<int> s{};

bf :-) confuciusornis /tmp> g++-10 t.cpp -std=c++20
t.cpp: In instantiation of ‘S< <template-parameter-1-1> >::~S() requires 
is_rvalue_reference<...auto...>(*(S< <template-parameter-1-1> >*)this) [with
<template-parameter-1-1> = int]’:
t.cpp:10:8:   required from here
t.cpp:7:40: internal compiler error: in tsubst_copy, at cp/pt.c:16383
    7 |     requires(std::is_rvalue_reference(*this));
      |                                        ^~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

bf :-( confuciusornis /tmp> g++-10 --version
g++-10 (Ubuntu 10.2.0-13ubuntu1) 10.2.0
Copyright (C) 2020 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.

bf :-) confuciusornis /tmp> 

Godbolt link: https://godbolt.org/z/cbE783

The error message from "godbolt" provides more information:

<source>: In instantiation of 'S< <template-parameter-1-1> >::~S() requires 
is_rvalue_reference<...auto...>(*(S< <template-parameter-1-1> >*)this) [with
<template-parameter-1-1> = int]':
<source>:10:8:   required from here
<source>:7:40: internal compiler error: in tsubst_copy, at cp/pt.c:16459
    7 |     requires(std::is_rvalue_reference(*this));
      |                                        ^~~~
0x1bf9b89 internal_error(char const*, ...)
        ???:0
0x6a2dba fancy_abort(char const*, int, char const*)
        ???:0
0x8b0f6a tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x727e8a constraints_satisfied_p(tree_node*)
        ???:0
0x7ad23b mark_used(tree_node*, int)
        ???:0
0x796713 register_dtor_fn(tree_node*)
        ???:0
0x7b1156 c_parse_final_cleanups()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
ASM generation compiler returned: 1
<source>: In instantiation of 'S< <template-parameter-1-1> >::~S() requires 
is_rvalue_reference<...auto...>(*(S< <template-parameter-1-1> >*)this) [with
<template-parameter-1-1> = int]':
<source>:10:8:   required from here
<source>:7:40: internal compiler error: in tsubst_copy, at cp/pt.c:16459
    7 |     requires(std::is_rvalue_reference(*this));
      |                                        ^~~~
0x1bf9b89 internal_error(char const*, ...)
        ???:0
0x6a2dba fancy_abort(char const*, int, char const*)
        ???:0
0x8b0f6a tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x727e8a constraints_satisfied_p(tree_node*)
        ???:0
0x7ad23b mark_used(tree_node*, int)
        ???:0
0x796713 register_dtor_fn(tree_node*)
        ???:0
0x7b1156 c_parse_final_cleanups()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Execution build compiler returned: 1

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

* [Bug c++/97837] ICE on requires with *this in destructor
  2020-11-15 10:28 [Bug c++/97837] New: ICE on requires with *this in destructor gccbugbjorn at fahller dot se
@ 2020-11-15 10:28 ` gccbugbjorn at fahller dot se
  2020-11-15 10:31 ` gccbugbjorn at fahller dot se
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gccbugbjorn at fahller dot se @ 2020-11-15 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Björn Fahller <gccbugbjorn at fahller dot se> ---
Created attachment 49561
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49561&action=edit
Source of failing program

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

* [Bug c++/97837] ICE on requires with *this in destructor
  2020-11-15 10:28 [Bug c++/97837] New: ICE on requires with *this in destructor gccbugbjorn at fahller dot se
  2020-11-15 10:28 ` [Bug c++/97837] " gccbugbjorn at fahller dot se
@ 2020-11-15 10:31 ` gccbugbjorn at fahller dot se
  2020-11-17 19:23 ` mpolacek at gcc dot gnu.org
  2022-12-13 14:24 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gccbugbjorn at fahller dot se @ 2020-11-15 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Björn Fahller <gccbugbjorn at fahller dot se> ---
Should maybe mention that the code is terribly wrong in so many ways, but the
compiler should still not crash because of it.

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

* [Bug c++/97837] ICE on requires with *this in destructor
  2020-11-15 10:28 [Bug c++/97837] New: ICE on requires with *this in destructor gccbugbjorn at fahller dot se
  2020-11-15 10:28 ` [Bug c++/97837] " gccbugbjorn at fahller dot se
  2020-11-15 10:31 ` gccbugbjorn at fahller dot se
@ 2020-11-17 19:23 ` mpolacek at gcc dot gnu.org
  2022-12-13 14:24 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-11-17 19:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-11-17

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

97837.C: In instantiation of ‘S< <template-parameter-1-1> >::~S() requires 
is_rvalue_reference<...auto...>(*(S< <template-parameter-1-1> >*)this) [with
<template-parameter-1-1> = int]’:
97837.C:10:8:   required from here
97837.C:7:40: internal compiler error: in tsubst_copy, at cp/pt.c:16450
    7 |     requires(std::is_rvalue_reference(*this));
      |                                        ^~~~
0xc8dd45 tsubst_copy
        /home/mpolacek/src/gcc/gcc/cp/pt.c:16450
0xca546b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:20535
0xc9fc00 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:19476
0xc9f9d6 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:19454
0xc88f3c tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:15217
0xca401d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:20306
0xca00af tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:19532
0xc9d976 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:18932
0xa4f3f8 satisfy_atom
        /home/mpolacek/src/gcc/gcc/cp/constraint.cc:2718
0xa4f738 satisfy_constraint_r
        /home/mpolacek/src/gcc/gcc/cp/constraint.cc:2781
0xa4f7b8 satisfy_constraint
        /home/mpolacek/src/gcc/gcc/cp/constraint.cc:2801
0xa4f85d satisfy_associated_constraints
        /home/mpolacek/src/gcc/gcc/cp/constraint.cc:2819
0xa4fc73 satisfy_declaration_constraints
        /home/mpolacek/src/gcc/gcc/cp/constraint.cc:2908
0xa4fe25 constraint_satisfaction_value
        /home/mpolacek/src/gcc/gcc/cp/constraint.cc:2950
0xa4ffca constraints_satisfied_p(tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/constraint.cc:2987
0xb1644f mark_used(tree_node*, int)
        /home/mpolacek/src/gcc/gcc/cp/decl2.c:5592
0xb17102 mark_used(tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/decl2.c:5726
0xad0236 register_dtor_fn(tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/decl.c:8846
0xb0f69b one_static_initialization_or_destruction
        /home/mpolacek/src/gcc/gcc/cp/decl2.c:4042
0xb0fbe8 do_static_initialization_or_destruction
        /home/mpolacek/src/gcc/gcc/cp/decl2.c:4128

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

* [Bug c++/97837] ICE on requires with *this in destructor
  2020-11-15 10:28 [Bug c++/97837] New: ICE on requires with *this in destructor gccbugbjorn at fahller dot se
                   ` (2 preceding siblings ...)
  2020-11-17 19:23 ` mpolacek at gcc dot gnu.org
@ 2022-12-13 14:24 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-13 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This is basically an ICE-on-invalid version of PR99961 which has been fixed in
GCC 11.1+

*** This bug has been marked as a duplicate of bug 99961 ***

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

end of thread, other threads:[~2022-12-13 14:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-15 10:28 [Bug c++/97837] New: ICE on requires with *this in destructor gccbugbjorn at fahller dot se
2020-11-15 10:28 ` [Bug c++/97837] " gccbugbjorn at fahller dot se
2020-11-15 10:31 ` gccbugbjorn at fahller dot se
2020-11-17 19:23 ` mpolacek at gcc dot gnu.org
2022-12-13 14:24 ` 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).