public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template
@ 2021-10-01 14:09 unlvsur at live dot com
2021-10-01 14:09 ` [Bug c++/102553] " unlvsur at live dot com
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: unlvsur at live dot com @ 2021-10-01 14:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
Bug ID: 102553
Summary: internal compiler error: Segmentation fault for struct
based parameter of template
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: unlvsur at live dot com
Target Milestone: ---
Created attachment 51531
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51531&action=edit
Linux Preprocessor file
x86_64-ubuntu-linux-gnu-g++ -c a.cc -I../../include -Ofast -std=c++20
-ffreestanding=
In file included from ../../include/fast_io_core_impl/integers/integer.h:5,
from ../../include/fast_io_core.h:63,
from a.cc:1:
../../include/fast_io_core_impl/integers/impl.h: In substitution of
'template<fast_io::manipulators::scalar_flags flags, class T> using
scalar_manip_precision_t = fast_io::manipulators::scalar_manip_t<((const
fast_io::manipulators::scalar_flags)flags),
fast_io::manipulators::precision_holder<T> > [with
fast_io::manipulators::scalar_flags flags =
dcmfloat_mani_flags_cache<uppercase, false,
fast_io::manipulators::floating_format::general>; T = __float128]':
../../include/fast_io_core_impl/integers/impl.h:418:148: required from here
../../include/fast_io_core_impl/integers/impl.h:108:49: internal compiler
error: Segmentation fault
108 | using scalar_manip_precision_t =
scalar_manip_t<flags,precision_holder<T>>;
Problem exists on other platforms too. You can just test preprocessor file
since it is freestanding.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] internal compiler error: Segmentation fault for struct based parameter of template
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
@ 2021-10-01 14:09 ` unlvsur at live dot com
2021-10-01 14:24 ` marxin at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: unlvsur at live dot com @ 2021-10-01 14:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
cqwrteur <unlvsur at live dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |unlvsur at live dot com
--- Comment #1 from cqwrteur <unlvsur at live dot com> ---
Created attachment 51532
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51532&action=edit
windows preprocessor file
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] internal compiler error: Segmentation fault for struct based parameter of template
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
2021-10-01 14:09 ` [Bug c++/102553] " unlvsur at live dot com
@ 2021-10-01 14:24 ` marxin at gcc dot gnu.org
2021-10-01 14:29 ` marxin at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-10-01 14:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-10-01
Status|UNCONFIRMED |NEW
CC| |marxin at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, I'm reducing that right now.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] internal compiler error: Segmentation fault for struct based parameter of template
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
2021-10-01 14:09 ` [Bug c++/102553] " unlvsur at live dot com
2021-10-01 14:24 ` marxin at gcc dot gnu.org
@ 2021-10-01 14:29 ` marxin at gcc dot gnu.org
2021-10-01 15:40 ` unlvsur at live dot com
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-10-01 14:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Can you compile it with clang?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] internal compiler error: Segmentation fault for struct based parameter of template
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
` (2 preceding siblings ...)
2021-10-01 14:29 ` marxin at gcc dot gnu.org
@ 2021-10-01 15:40 ` unlvsur at live dot com
2021-10-01 15:40 ` unlvsur at live dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: unlvsur at live dot com @ 2021-10-01 15:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
--- Comment #4 from cqwrteur <unlvsur at live dot com> ---
(In reply to Martin Liška from comment #3)
> Can you compile it with clang?
yes I can
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] internal compiler error: Segmentation fault for struct based parameter of template
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
` (3 preceding siblings ...)
2021-10-01 15:40 ` unlvsur at live dot com
@ 2021-10-01 15:40 ` unlvsur at live dot com
2021-10-01 18:25 ` marxin at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: unlvsur at live dot com @ 2021-10-01 15:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
--- Comment #5 from cqwrteur <unlvsur at live dot com> ---
(In reply to Martin Liška from comment #3)
> Can you compile it with clang?
msvc, clang they all work.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] internal compiler error: Segmentation fault for struct based parameter of template
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
` (4 preceding siblings ...)
2021-10-01 15:40 ` unlvsur at live dot com
@ 2021-10-01 18:25 ` marxin at gcc dot gnu.org
2022-11-30 5:20 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-10-01 18:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Can you please attach a pre-processed source file generated by clang?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] internal compiler error: Segmentation fault for struct based parameter of template
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
` (5 preceding siblings ...)
2021-10-01 18:25 ` marxin at gcc dot gnu.org
@ 2022-11-30 5:20 ` pinskia at gcc dot gnu.org
2022-11-30 5:23 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-30 5:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
REduced somewhat and yes clang compiles this just fine, still trying to reduce
it further:
struct scalar_flags{};
template<bool> inline constexpr scalar_flags dcmfloat_mani_flags_cache{};
template<scalar_flags flags>
struct scalar_manip_t{};
template<typename T>
struct precision_holder{
template<scalar_flags flags>
using scalar_manip_precision_t = scalar_manip_t<flags>;
auto general(int n)
{
return scalar_manip_precision_t<dcmfloat_mani_flags_cache<true>>{};
}
};
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] internal compiler error: Segmentation fault for struct based parameter of template
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
` (6 preceding siblings ...)
2022-11-30 5:20 ` pinskia at gcc dot gnu.org
@ 2022-11-30 5:23 ` pinskia at gcc dot gnu.org
2022-11-30 5:23 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-30 5:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced all the way:
struct s1{};
template<int> inline constexpr s1 ch{};
template<s1 f> struct s2{};
template<s1 f> using alias1 = s2<f>;
template<typename T>
void general(int n)
{
alias1<ch<1>>{};
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] internal compiler error: Segmentation fault for struct based parameter of template
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
` (7 preceding siblings ...)
2022-11-30 5:23 ` pinskia at gcc dot gnu.org
@ 2022-11-30 5:23 ` pinskia at gcc dot gnu.org
2022-12-20 16:09 ` [Bug c++/102553] ICE (seg fault) in strip_array_types with NTTP and template alias cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-30 5:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Full backtrace:
0x121ce0f crash_signal
/home/apinski/src/upstream-gcc/gcc/gcc/toplev.cc:314
0x14e5890 strip_array_types(tree_node*)
/home/apinski/src/upstream-gcc/gcc/gcc/tree.cc:7262
0xc55408 cp_type_quals(tree_node const*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/typeck.cc:11471
0xbc5fbf tsubst_copy
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:17282
0xbc883d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:21590
0xbd5e5f tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:19694
0xbdbcf5 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:13627
0xbeff95 tsubst_aggr_type
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:13875
0xbd1e6e tsubst_decl
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:15101
0xbf42a7 instantiate_template(tree_node*, tree_node*, int)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:21842
0xbce4f4 instantiate_alias_template
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:21925
0xbce4f4 tsubst(tree_node*, tree_node*, int, tree_node*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:15755
0xbef16e lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:10013
0xc1b2ed finish_template_type(tree_node*, tree_node*, int)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/semantics.cc:3773
0xb85e18 cp_parser_template_id
/home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:18422
0xb8608b cp_parser_class_name
/home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:25889
0xb7b14e cp_parser_qualifying_entity
/home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:7193
0xb7b14e cp_parser_nested_name_specifier_opt
/home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:6875
0xb95e28 cp_parser_simple_type_specifier
/home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:19863
0xb6e9e6 cp_parser_type_specifier
/home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:19519
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] ICE (seg fault) in strip_array_types with NTTP and template alias
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
` (8 preceding siblings ...)
2022-11-30 5:23 ` pinskia at gcc dot gnu.org
@ 2022-12-20 16:09 ` cvs-commit at gcc dot gnu.org
2022-12-20 16:12 ` ppalka at gcc dot gnu.org
2023-08-03 14:05 ` ppalka at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-20 16:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
--- Comment #10 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:49b6b7ac3314843466395c4a194aa178c80e64f5
commit r13-4807-g49b6b7ac3314843466395c4a194aa178c80e64f5
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Dec 20 11:09:11 2022 -0500
c++: NTTP object wrapper substitution fixes [PR103346, ...]
This patch fixes some issues with substitution into a C++20 template
parameter object wrapper:
* The first testcase demonstrates a situation where the same_type_p
assert in relevant case of tsubst_copy doesn't hold, because (partial)
substitution of {int,} into the wrapper's TREE_TYPE yields A<int> but
substitution into the underlying TEMPLATE_PARM_INDEX is a nop due to
tsubst's level==1/tf_partial early exit tests, hence TREE_TYPE in the
latter case remains A<T>. So this patch just gets rid of the assert;
the type mismatch doesn't seem to be a problem in practice.
* In the second testcase, dependent substitution into the underlying
TEMPLATE_PARM_INDEX yields a CALL_EXPR with empty TREE_TYPE, which
tsubst_copy doesn't expect. This patch fixes this by handling empty
TREE_TYPE the same way as a non-const TREE_TYPE. Moreover, after
this substitution we're left with a VIEW_CONVERT_EXPR wrapping a
CALL_EXPR instead of a TEMPLATE_PARM_INDEX, which during the subsequent
non-dependent substitution tsubst_copy doesn't expect either. So
this patch also relaxes tsubst_copy to accept such VIEW_CONVERT_EXPR
too.
* In the third testcase, we end up never resolving the call to
f.modify() because tsubst_copy doesn't do overload resolution.
This patch fixes this by moving the handling of these
VIEW_CONVERT_EXPR wrappers from tsubst_copy to tsubst_copy_and_build.
For good measure tsubst_copy_and_build should also handle
REF_PARENTHESIZED_P wrappers instead of delegating to tsubst_copy.
PR c++/103346
PR c++/104278
PR c++/102553
gcc/cp/ChangeLog:
* pt.cc (tsubst_copy) <case VIEW_CONVERT_EXPR>: Move the
handling of C++20 template parameter object wrappers to ...
(tsubst_copy_and_build) <case VIEW_CONVERT_EXPR>: ... here.
Accept non-TEMPLATE_PARM_INDEX inner operand. Handle empty
TREE_TYPE on substituted inner operand. Remove same_type_p
assert. Also handle REF_PARENTHESIZED_P VIEW_CONVERT_EXPRs.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/nontype-class52a.C: New test.
* g++.dg/cpp2a/nontype-class53.C: New test.
* g++.dg/cpp2a/nontype-class54.C: New test.
* g++.dg/cpp2a/nontype-class55.C: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] ICE (seg fault) in strip_array_types with NTTP and template alias
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
` (9 preceding siblings ...)
2022-12-20 16:09 ` [Bug c++/102553] ICE (seg fault) in strip_array_types with NTTP and template alias cvs-commit at gcc dot gnu.org
@ 2022-12-20 16:12 ` ppalka at gcc dot gnu.org
2023-08-03 14:05 ` ppalka at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-20 16:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Known to work| |13.0
CC| |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/102553] ICE (seg fault) in strip_array_types with NTTP and template alias
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
` (10 preceding siblings ...)
2022-12-20 16:12 ` ppalka at gcc dot gnu.org
@ 2023-08-03 14:05 ` ppalka at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-08-03 14:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102553
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |13.0
Status|ASSIGNED |RESOLVED
--- Comment #11 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 13
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-08-03 14:05 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 14:09 [Bug c++/102553] New: internal compiler error: Segmentation fault for struct based parameter of template unlvsur at live dot com
2021-10-01 14:09 ` [Bug c++/102553] " unlvsur at live dot com
2021-10-01 14:24 ` marxin at gcc dot gnu.org
2021-10-01 14:29 ` marxin at gcc dot gnu.org
2021-10-01 15:40 ` unlvsur at live dot com
2021-10-01 15:40 ` unlvsur at live dot com
2021-10-01 18:25 ` marxin at gcc dot gnu.org
2022-11-30 5:20 ` pinskia at gcc dot gnu.org
2022-11-30 5:23 ` pinskia at gcc dot gnu.org
2022-11-30 5:23 ` pinskia at gcc dot gnu.org
2022-12-20 16:09 ` [Bug c++/102553] ICE (seg fault) in strip_array_types with NTTP and template alias cvs-commit at gcc dot gnu.org
2022-12-20 16:12 ` ppalka at gcc dot gnu.org
2023-08-03 14:05 ` 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).