public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115219] New: ICE on conditionally noexcept class operator delete
@ 2024-05-24 22:51 pobrn at protonmail dot com
2024-05-24 23:04 ` [Bug c++/115219] [c++17+] ICE on depdendent " pinskia at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: pobrn at protonmail dot com @ 2024-05-24 22:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115219
Bug ID: 115219
Summary: ICE on conditionally noexcept class operator delete
Product: gcc
Version: 14.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pobrn at protonmail dot com
Target Milestone: ---
Consider the following piece of C++ code:
```
#include <new>
#include <type_traits>
template<typename Derived>
struct B {
static void *
operator new(std::size_t s, std::size_t)
{ return ::operator new(s); }
static void
operator delete(void *)
noexcept(std::is_nothrow_destructible_v<Derived>)
{ }
};
struct A : B<A> { };
void test() {
new (42) A();
}
```
gcc 14.1.1 and trunk (on CE) trigger the following ICE (
https://gcc.godbolt.org/z/z7av1Mf3Y ):
```
<source>: In function 'void test()':
<source>:19:16: internal compiler error: in type_throw_all_p, at
cp/except.cc:1234
19 | new (42) A();
| ^
0x268e9ac internal_error(char const*, ...)
???:0
0xa5b247 fancy_abort(char const*, int, char const*)
???:0
0xb08bb3 fnptr_conv_p(tree_node*, tree_node*)
???:0
0xaa0ae6 instantiate_type(tree_node*, tree_node*, int)
???:0
0xa75b7e build_op_delete_call(tree_code, tree_node*, tree_node*, bool,
tree_node*, tree_node*, int)
???:0
0xb82ab0 build_new(unsigned int, vec<tree_node*, va_gc, vl_embed>**,
tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int, int)
???:0
0xc63d8a c_parse_file()
???:0
0xdb95b9 c_common_parse_file()
???:0
```
Removing the conditional noexcept specification makes the ICE go away.
Here is a more detailed stack trace from the arch linux build of gcc (about
14.1.1):
```
Breakpoint 1, internal_error (gmsgid=gmsgid@entry=0x2b4b860 "in %s, at %s:%d")
at /usr/src/debug/gcc/gcc/gcc/diagnostic.cc:2227
2227 {
(gdb) bt
#0 internal_error (gmsgid=gmsgid@entry=0x2b4b860 "in %s, at %s:%d") at
/usr/src/debug/gcc/gcc/gcc/diagnostic.cc:2227
#1 0x0000000000703e88 in fancy_abort (file=0x2b5c798
"/usr/src/debug/gcc/gcc/gcc/cp/except.cc", line=1234, function=0x2aa87dc
"type_throw_all_p") at /usr/src/debug/gcc/gcc/gcc/diagnostic.cc:2353
#2 0x00000000006b97f2 in type_throw_all_p (type=<optimized out>) at
/usr/src/debug/gcc/gcc/gcc/cp/except.cc:1231
#3 type_throw_all_p (type=<optimized out>) at
/usr/src/debug/gcc/gcc/gcc/cp/except.cc:1231
#4 noexcept_conv_p (to=0x7ffff6c24498, from=0x7ffff6a15930) at
/usr/src/debug/gcc/gcc/gcc/cp/cvt.cc:2130
#5 fnptr_conv_p (to=<optimized out>, from=<optimized out>) at
/usr/src/debug/gcc/gcc/gcc/cp/cvt.cc:2157
#6 0x000000000072a772 in instantiate_type (lhstype=0x7ffff6c24498,
rhs=0x7ffff6a10690, complain=0) at /usr/src/debug/gcc/gcc/gcc/cp/class.cc:9085
#7 0x000000000072cede in build_op_delete_call (code=DELETE_EXPR,
addr=0x7ffff6a1e1e0, size=0x7ffff6e212d0, global_p=<optimized out>,
placement=0x7ffff6a1b340, alloc_fn=0x7ffff6de9700, complain=3)
at /usr/src/debug/gcc/gcc/gcc/cp/call.cc:7893
#8 0x0000000000804299 in build_new_1
(placement=placement@entry=0x7fffffffcd78, type=<optimized out>,
nelts=<optimized out>, nelts@entry=0x0, init=init@entry=0x7fffffffcd70,
globally_qualified_p=globally_qualified_p@entry=false,
complain=complain@entry=3) at /usr/src/debug/gcc/gcc/gcc/cp/init.cc:3784
#9 0x00000000008055ca in build_new (loc=64384747, placement=0x7fffffffcd78,
type=<optimized out>, nelts=0x0, init=0x7fffffffcd70, use_global_new=0,
complain=3) at /usr/src/debug/gcc/gcc/gcc/cp/init.cc:4054
#10 0x0000000000867ab7 in cp_parser_new_expression
(parser=parser@entry=0x7ffff6fb4dc8) at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:9659
#11 0x000000000086258b in cp_parser_unary_expression (parser=0x7ffff6fb4dc8,
pidk=<optimized out>, address_p=<optimized out>, cast_p=<optimized out>,
decltype_p=<optimized out>)
at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:9245
#12 0x0000000000864664 in cp_parser_binary_expression
(parser=parser@entry=0x7ffff6fb4dc8, cast_p=cast_p@entry=false,
no_toplevel_fold_p=no_toplevel_fold_p@entry=false,
decltype_p=decltype_p@entry=false,
prec=prec@entry=PREC_NOT_OPERATOR, pidk=pidk@entry=0x0) at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:10393
#13 0x00000000008653bd in cp_parser_assignment_expression
(parser=parser@entry=0x7ffff6fb4dc8, pidk=pidk@entry=0x0,
cast_p=cast_p@entry=false, decltype_p=decltype_p@entry=false)
at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:10737
#14 0x0000000000865994 in cp_parser_expression
(parser=parser@entry=0x7ffff6fb4dc8, pidk=pidk@entry=0x0,
cast_p=cast_p@entry=false, decltype_p=decltype_p@entry=false,
warn_comma_p=warn_comma_p@entry=false)
at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:10903
#15 0x000000000086622e in cp_parser_expression_statement
(parser=0x7ffff6fb4dc8, in_statement_expr=0x0) at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:13166
#16 0x0000000000876d31 in cp_parser_statement
(parser=parser@entry=0x7ffff6fb4dc8,
in_statement_expr=in_statement_expr@entry=0x0,
in_compound=in_compound@entry=true, if_p=if_p@entry=0x0, chain=chain@entry=0x0,
loc_after_labels=loc_after_labels@entry=0x0) at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:12947
#17 0x0000000000877b0c in cp_parser_statement_seq_opt
(parser=parser@entry=0x7ffff6fb4dc8,
in_statement_expr=in_statement_expr@entry=0x0) at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:13418
#18 0x0000000000877d40 in cp_parser_compound_statement (parser=0x7ffff6fb4dc8,
in_statement_expr=0x0, bcs_flags=<optimized out>, function_body=true) at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:13272
#19 0x0000000000883042 in cp_parser_function_body (parser=0x7ffff6fb4dc8,
in_function_try_block=false) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:25987
#20 cp_parser_ctor_initializer_opt_and_function_body (parser=0x7ffff6fb4dc8,
in_function_try_block=false) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:26038
#21 0x00000000008a8d2b in cp_parser_function_definition_after_declarator
(parser=parser@entry=0x7ffff6fb4dc8, inline_p=inline_p@entry=false) at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:32729
#22 0x00000000008a9e50 in
cp_parser_function_definition_from_specifiers_and_declarator
(parser=0x7ffff6fb4dc8, decl_specifiers=<optimized out>, attributes=0x0,
declarator=0x31fb9a0)
at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:32647
#23 cp_parser_init_declarator (parser=0x7ffff6fb4dc8, flags=<optimized out>,
decl_specifiers=<optimized out>, checks=0x0,
function_definition_allowed_p=<optimized out>, member_p=false,
declares_class_or_enum=0, function_definition_p=0x7fffffffd6f8,
maybe_range_for_decl=0x0, init_loc=0x7fffffffd6f0, auto_result=0x7fffffffd700)
at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:23366
#24 0x0000000000873c72 in cp_parser_simple_declaration (parser=0x7ffff6fb4dc8,
function_definition_allowed_p=<optimized out>, maybe_range_for_decl=0x0) at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:15900
#25 0x0000000000878ccd in cp_parser_declaration (parser=0x7ffff6fb4dc8,
prefix_attrs=0x0) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:15573
#26 0x0000000000879734 in cp_parser_toplevel_declaration
(parser=0x7ffff6fb4dc8) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:15594
#27 cp_parser_translation_unit (parser=0x7ffff6fb4dc8) at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:5279
#28 0x00000000009c4ed1 in c_parse_file () at
/usr/src/debug/gcc/gcc/gcc/cp/parser.cc:51269
#29 c_common_parse_file () at
/usr/src/debug/gcc/gcc/gcc/c-family/c-opts.cc:1311
#30 0x0000000000fa020f in compile_file () at
/usr/src/debug/gcc/gcc/gcc/toplev.cc:449
#31 0x000000000070d122 in do_compile () at
/usr/src/debug/gcc/gcc/gcc/toplev.cc:2154
#32 toplev::main (this=<optimized out>, argc=<optimized out>, argv=<optimized
out>) at /usr/src/debug/gcc/gcc/gcc/toplev.cc:2310
#33 0x000000000070da36 in main (argc=<optimized out>, argv=<optimized out>) at
/usr/src/debug/gcc/gcc/gcc/main.cc:39
```
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/115219] [c++17+] ICE on depdendent noexcept class operator delete
2024-05-24 22:51 [Bug c++/115219] New: ICE on conditionally noexcept class operator delete pobrn at protonmail dot com
@ 2024-05-24 23:04 ` pinskia at gcc dot gnu.org
2024-05-24 23:04 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-24 23:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115219
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE on conditionally |[c++17+] ICE on depdendent
|noexcept class operator |noexcept class operator
|delete |delete
Known to fail| |7.1.0, 8.5.0
Keywords| |ice-on-valid-code
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed reduced testcase:
```
using t = decltype(sizeof(0));
template <typename _Tp>
constexpr bool is_nothrow_destructible_v =
false;
template<typename Derived>
struct B {
static void * operator new(t s, t);
static void
operator delete(void *)
noexcept(is_nothrow_destructible_v<int>)
;
};
void test() {
new (42) B<int>();
}
```
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/115219] [c++17+] ICE on depdendent noexcept class operator delete
2024-05-24 22:51 [Bug c++/115219] New: ICE on conditionally noexcept class operator delete pobrn at protonmail dot com
2024-05-24 23:04 ` [Bug c++/115219] [c++17+] ICE on depdendent " pinskia at gcc dot gnu.org
@ 2024-05-24 23:04 ` pinskia at gcc dot gnu.org
2024-05-24 23:05 ` [Bug c++/115219] [11/12/13/14/15 Regression] " pinskia at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-24 23:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115219
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-05-24
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/115219] [11/12/13/14/15 Regression] [c++17+] ICE on depdendent noexcept class operator delete
2024-05-24 22:51 [Bug c++/115219] New: ICE on conditionally noexcept class operator delete pobrn at protonmail dot com
2024-05-24 23:04 ` [Bug c++/115219] [c++17+] ICE on depdendent " pinskia at gcc dot gnu.org
2024-05-24 23:04 ` pinskia at gcc dot gnu.org
@ 2024-05-24 23:05 ` pinskia at gcc dot gnu.org
2024-05-24 23:40 ` pobrn at protonmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-24 23:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115219
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.5
Summary|[c++17+] ICE on depdendent |[11/12/13/14/15 Regression]
|noexcept class operator |[c++17+] ICE on depdendent
|delete |noexcept class operator
| |delete
Known to work| |6.5.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/115219] [11/12/13/14/15 Regression] [c++17+] ICE on depdendent noexcept class operator delete
2024-05-24 22:51 [Bug c++/115219] New: ICE on conditionally noexcept class operator delete pobrn at protonmail dot com
` (2 preceding siblings ...)
2024-05-24 23:05 ` [Bug c++/115219] [11/12/13/14/15 Regression] " pinskia at gcc dot gnu.org
@ 2024-05-24 23:40 ` pobrn at protonmail dot com
2024-05-24 23:48 ` pinskia at gcc dot gnu.org
2024-07-19 13:25 ` [Bug c++/115219] [12/13/14/15 Regression] [c++17+] ICE on dependent " rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pobrn at protonmail dot com @ 2024-05-24 23:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115219
--- Comment #3 from Barnabás Pőcze <pobrn at protonmail dot com> ---
That reduced test case compiles fine for me. On CE, too. Am I missing some
compilation flags?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/115219] [11/12/13/14/15 Regression] [c++17+] ICE on depdendent noexcept class operator delete
2024-05-24 22:51 [Bug c++/115219] New: ICE on conditionally noexcept class operator delete pobrn at protonmail dot com
` (3 preceding siblings ...)
2024-05-24 23:40 ` pobrn at protonmail dot com
@ 2024-05-24 23:48 ` pinskia at gcc dot gnu.org
2024-07-19 13:25 ` [Bug c++/115219] [12/13/14/15 Regression] [c++17+] ICE on dependent " rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-24 23:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115219
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Barnabás Pőcze from comment #3)
> That reduced test case compiles fine for me. On CE, too. Am I missing some
> compilation flags?
Oh I reduced it with an older version but newer versions (GCC 13+) don't ICE
there.
Anyways here is new reduced testcase:
```
using t = decltype(sizeof(0));
template <typename _Tp>
constexpr bool is_nothrow_destructible_v =
false;
template<typename T>
struct B {
static void * operator new(t s, t);
static void
operator delete(void *)
noexcept(is_nothrow_destructible_v<T>)
;
};
void test() {
new (42) B<int>();
}
```
The only difference between this one and the previous one is that noexcept is
is_nothrow_destructible_v<T> vs is_nothrow_destructible_v<int>. Meaning it is
dependent in the new version while in the old one is not; it seems like GCC 13+
can handle non-dependent values there.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/115219] [12/13/14/15 Regression] [c++17+] ICE on dependent noexcept class operator delete
2024-05-24 22:51 [Bug c++/115219] New: ICE on conditionally noexcept class operator delete pobrn at protonmail dot com
` (4 preceding siblings ...)
2024-05-24 23:48 ` pinskia at gcc dot gnu.org
@ 2024-07-19 13:25 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-07-19 13:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115219
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.5 |12.5
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11 branch is being closed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-07-19 13:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-24 22:51 [Bug c++/115219] New: ICE on conditionally noexcept class operator delete pobrn at protonmail dot com
2024-05-24 23:04 ` [Bug c++/115219] [c++17+] ICE on depdendent " pinskia at gcc dot gnu.org
2024-05-24 23:04 ` pinskia at gcc dot gnu.org
2024-05-24 23:05 ` [Bug c++/115219] [11/12/13/14/15 Regression] " pinskia at gcc dot gnu.org
2024-05-24 23:40 ` pobrn at protonmail dot com
2024-05-24 23:48 ` pinskia at gcc dot gnu.org
2024-07-19 13:25 ` [Bug c++/115219] [12/13/14/15 Regression] [c++17+] ICE on dependent " rguenth 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).