public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106925] New: internal compiler error: Segmentation fault
@ 2022-09-13 11:58 carlosgalvezp at gmail dot com
2022-09-13 14:17 ` [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790 marxin at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: carlosgalvezp at gmail dot com @ 2022-09-13 11:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925
Bug ID: 106925
Summary: internal compiler error: Segmentation fault
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: carlosgalvezp at gmail dot com
Target Milestone: ---
The following minimal example leads to a segfault of GCC on latest trunk:
#include <array>
template <typename T, std::size_t size>
struct MyVector
{
std::array<T, size> data{};
};
template <typename T>
struct Foo final
{
T a{0};
};
constexpr std::size_t kSize = 1;
void foo(MyVector<Foo<float>, kSize> input = MyVector<Foo<float>, kSize>())
{
}
<source>: In instantiation of 'constexpr MyVector<Foo<float>, 1>::MyVector()':
<source>:17:74: required from here
<source>:6:25: internal compiler error: Segmentation fault
6 | std::array<T, size> data{};
| ^~~~
0x23428ae internal_error(char const*, ...)
???:0
0xb9cae7 maybe_splice_retval_cleanup(tree_node*)
???:0
0xce4fc2 do_poplevel(tree_node*)
???:0
0xce7973 finish_for_stmt(tree_node*)
???:0
0xba5019 build_vec_init(tree_node*, tree_node*, tree_node*, bool, int, int,
vec<tree_node*, va_gc, vl_embed>**)
???:0
0xd0ee2e expand_vec_init_expr(tree_node*, tree_node*, int, vec<tree_node*,
va_gc, vl_embed>**)
???:0
0xd494d1 digest_nsdmi_init(tree_node*, tree_node*, int)
???:0
0xbaabe5 get_nsdmi(tree_node*, bool, int)
???:0
0xbd282d get_defaulted_eh_spec(tree_node*, int)
???:0
0xc9d42a maybe_instantiate_noexcept(tree_node*, int)
???:0
0xc9d23a maybe_instantiate_noexcept(tree_node*, int)
???:0
0xb85043 mark_used(tree_node*, int)
???:0
0xac7bfb build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
???:0
0xac9027 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
???:0
0xba3b2c build_value_init(tree_node*, int)
???:0
0xd4a73a build_functional_cast(unsigned int, tree_node*, tree_node*, int)
???:0
0xc743a7 c_parse_file()
???:0
0xdae9f9 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
Can be reproduced on Compiler Explorer:
https://godbolt.org/z/fconh9nKa
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
@ 2022-09-13 14:17 ` marxin at gcc dot gnu.org
2022-10-10 6:31 ` carlosgalvezp at gmail dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-09-13 14:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|internal compiler error: |[12/13 Regression] ICE in
|Segmentation fault |maybe_splice_retval_cleanup
| |at gcc/cp/except.cc:1330
| |since
| |r12-8066-g4822108e61ab8790
Target Milestone|--- |12.3
Last reconfirmed| |2022-09-13
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Since r12-8066-g4822108e61ab8790, reduced test-case:
$ cat pr106925.ii
struct Foo;
template <int _Nm> struct __array_traits { typedef Foo _Type[_Nm]; };
template <int _Nm> struct array {
typename __array_traits<_Nm>::_Type _M_elems;
};
template <int size> struct MyVector { array<size> data{}; };
struct Foo {
float a{0};
};
void foo(MyVector<1> = MyVector<1>());
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
2022-09-13 14:17 ` [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790 marxin at gcc dot gnu.org
@ 2022-10-10 6:31 ` carlosgalvezp at gmail dot com
2022-10-11 17:52 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: carlosgalvezp at gmail dot com @ 2022-10-10 6:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925
--- Comment #2 from Carlos Galvez <carlosgalvezp at gmail dot com> ---
Hi, is there any progress on the issue?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
2022-09-13 14:17 ` [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790 marxin at gcc dot gnu.org
2022-10-10 6:31 ` carlosgalvezp at gmail dot com
@ 2022-10-11 17:52 ` mpolacek at gcc dot gnu.org
2022-10-11 18:21 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-10-11 17:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think the problem is that since r12-8066, in cxx_eval_vec_init we perform
expand_vec_init_expr while processing the default argument, at which point
start_preparsed_function hasn't yet set current_function_decl.
expand_vec_init_expr then leads to maybe_splice_retval_cleanup which checks
DECL_CONSTRUCTOR_P (current_function_decl) without checking that
current_function_decl is non-null first. It seems correct that
current_function_decl is null at that point, so the fix should be just:
--- a/gcc/cp/except.cc
+++ b/gcc/cp/except.cc
@@ -1327,6 +1327,7 @@ maybe_splice_retval_cleanup (tree compound_stmt)
&& current_binding_level->level_chain->kind == sk_function_parms);
if ((function_body || current_binding_level->kind == sk_try)
+ && current_function_decl
&& !DECL_CONSTRUCTOR_P (current_function_decl)
&& !DECL_DESTRUCTOR_P (current_function_decl)
&& current_retval_sentinel)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
` (2 preceding siblings ...)
2022-10-11 17:52 ` mpolacek at gcc dot gnu.org
@ 2022-10-11 18:21 ` mpolacek at gcc dot gnu.org
2022-10-13 15:06 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-10-11 18:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Priority|P3 |P2
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Well, why don't I go ahead and post it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
` (3 preceding siblings ...)
2022-10-11 18:21 ` mpolacek at gcc dot gnu.org
@ 2022-10-13 15:06 ` cvs-commit at gcc dot gnu.org
2022-10-13 15:09 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-13 15:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:3130e70dab1e64a7b014391fe941090d5f3b6b7d
commit r13-3277-g3130e70dab1e64a7b014391fe941090d5f3b6b7d
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Oct 11 14:16:54 2022 -0400
c++: ICE with VEC_INIT_EXPR and defarg [PR106925]
Since r12-8066, in cxx_eval_vec_init we perform expand_vec_init_expr
while processing the default argument in this test. At this point
start_preparsed_function hasn't yet set current_function_decl.
expand_vec_init_expr then leads to maybe_splice_retval_cleanup which
checks DECL_CONSTRUCTOR_P (current_function_decl) without checking that
c_f_d is non-null first. It seems correct that c_f_d is null here, so
it seems to me that maybe_splice_retval_cleanup should check c_f_d as
in the following patch.
PR c++/106925
gcc/cp/ChangeLog:
* except.cc (maybe_splice_retval_cleanup): Check
current_function_decl.
Make the bool const.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/initlist-defarg3.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
` (4 preceding siblings ...)
2022-10-13 15:06 ` cvs-commit at gcc dot gnu.org
@ 2022-10-13 15:09 ` cvs-commit at gcc dot gnu.org
2022-10-13 15:10 ` mpolacek at gcc dot gnu.org
2022-10-14 6:18 ` carlosgalvezp at gmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-13 15:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:8794633003318113e03147a727e63f5d55b350ab
commit r12-8829-g8794633003318113e03147a727e63f5d55b350ab
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Oct 11 14:16:54 2022 -0400
c++: ICE with VEC_INIT_EXPR and defarg [PR106925]
Since r12-8066, in cxx_eval_vec_init we perform expand_vec_init_expr
while processing the default argument in this test. At this point
start_preparsed_function hasn't yet set current_function_decl.
expand_vec_init_expr then leads to maybe_splice_retval_cleanup which
checks DECL_CONSTRUCTOR_P (current_function_decl) without checking that
c_f_d is non-null first. It seems correct that c_f_d is null here, so
it seems to me that maybe_splice_retval_cleanup should check c_f_d as
in the following patch.
PR c++/106925
gcc/cp/ChangeLog:
* except.cc (maybe_splice_retval_cleanup): Check
current_function_decl.
Make the bool const.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/initlist-defarg3.C: New test.
(cherry picked from commit 3130e70dab1e64a7b014391fe941090d5f3b6b7d)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
` (5 preceding siblings ...)
2022-10-13 15:09 ` cvs-commit at gcc dot gnu.org
@ 2022-10-13 15:10 ` mpolacek at gcc dot gnu.org
2022-10-14 6:18 ` carlosgalvezp at gmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-10-13 15:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
` (6 preceding siblings ...)
2022-10-13 15:10 ` mpolacek at gcc dot gnu.org
@ 2022-10-14 6:18 ` carlosgalvezp at gmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: carlosgalvezp at gmail dot com @ 2022-10-14 6:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925
--- Comment #8 from Carlos Galvez <carlosgalvezp at gmail dot com> ---
Awesome, thanks a lot for the quick fix!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-10-14 6:18 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
2022-09-13 14:17 ` [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790 marxin at gcc dot gnu.org
2022-10-10 6:31 ` carlosgalvezp at gmail dot com
2022-10-11 17:52 ` mpolacek at gcc dot gnu.org
2022-10-11 18:21 ` mpolacek at gcc dot gnu.org
2022-10-13 15:06 ` cvs-commit at gcc dot gnu.org
2022-10-13 15:09 ` cvs-commit at gcc dot gnu.org
2022-10-13 15:10 ` mpolacek at gcc dot gnu.org
2022-10-14 6:18 ` carlosgalvezp at gmail 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).