public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508
@ 2023-12-15 11:22 redi at gcc dot gnu.org
2023-12-15 11:26 ` [Bug c++/113031] " redi at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2023-12-15 11:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113031
Bug ID: 113031
Summary: [14 Regression] ICE in cxx_fold_indirect_ref_1
starting with r14-6508
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
CC: nathanieloshead at gmail dot com
Target Milestone: ---
I'm seeing new ICEs in the libstdc++ testsuite with the following non-default
settings:
>
> GLIBCXX_TESTSUITE_STDS=20 make check RUNTESTFLAGS="--target_board=unix/-D_GLIBCXX_USE_CXX11_ABI=0"
>
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/variant:1626:17:
internal compiler error: Segmentation fault
0x11373c4 crash_signal
../../gcc/toplev.cc:316
0x496192 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5712
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
0x496487 cxx_fold_indirect_ref_1
../../gcc/cp/constexpr.cc:5743
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] 9+ messages in thread
* [Bug c++/113031] [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508
2023-12-15 11:22 [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508 redi at gcc dot gnu.org
@ 2023-12-15 11:26 ` redi at gcc dot gnu.org
2023-12-15 12:52 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2023-12-15 11:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113031
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 56884
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56884&action=edit
Gzipped preprocessed source
Compile the attached .ii with '-std=gnu++20 -O' (or any non-zero optimization
level) to reproduce the ICE.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/113031] [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508
2023-12-15 11:22 [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508 redi at gcc dot gnu.org
2023-12-15 11:26 ` [Bug c++/113031] " redi at gcc dot gnu.org
@ 2023-12-15 12:52 ` rguenth at gcc dot gnu.org
2023-12-15 13:52 ` nathanieloshead at gmail dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-12-15 12:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113031
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/113031] [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508
2023-12-15 11:22 [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508 redi at gcc dot gnu.org
2023-12-15 11:26 ` [Bug c++/113031] " redi at gcc dot gnu.org
2023-12-15 12:52 ` rguenth at gcc dot gnu.org
@ 2023-12-15 13:52 ` nathanieloshead at gmail dot com
2023-12-15 13:53 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: nathanieloshead at gmail dot com @ 2023-12-15 13:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113031
--- Comment #2 from Nathaniel Shead <nathanieloshead at gmail dot com> ---
Reduced to:
template <typename> class variant;
template <typename _Types, typename _Tp>
auto __variant_cast(_Tp __rhs) { return static_cast<variant<_Types>&&>(__rhs);
}
template <typename _Types>
struct _Move_assign_base : _Types {
void operator=(_Move_assign_base __rhs) { __variant_cast<_Types>(__rhs); }
};
template <typename _Types>
struct variant : _Move_assign_base<_Types> {
void emplace() {
variant __tmp;
*this = __tmp;
}
};
struct _Undefined_class {
struct _Nocopy_types {
void (_Undefined_class::*_M_member_pointer)();
};
struct function : _Nocopy_types {
struct optional {
void test03() {
variant<function> v;
v.emplace();
}
};
};
};
The following patch seems to fix the immediate problem (but not yet fully
regtested):
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index e1b2d27fc36..051f73fb73f 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -5709,7 +5709,8 @@ cxx_fold_indirect_ref_1 (const constexpr_ctx *ctx,
location_t loc, tree type,
}
/* Handle conversion to "as base" type. */
- if (CLASSTYPE_AS_BASE (optype) == type)
+ if (CLASS_TYPE_P (optype)
+ && CLASSTYPE_AS_BASE (optype) == type)
return op;
/* Handle conversion to an empty base class, which is represented with a
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/113031] [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508
2023-12-15 11:22 [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508 redi at gcc dot gnu.org
` (2 preceding siblings ...)
2023-12-15 13:52 ` nathanieloshead at gmail dot com
@ 2023-12-15 13:53 ` redi at gcc dot gnu.org
2023-12-16 4:11 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2023-12-15 13:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113031
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-12-15
Ever confirmed|0 |1
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That was quick, thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/113031] [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508
2023-12-15 11:22 [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508 redi at gcc dot gnu.org
` (3 preceding siblings ...)
2023-12-15 13:53 ` redi at gcc dot gnu.org
@ 2023-12-16 4:11 ` cvs-commit at gcc dot gnu.org
2023-12-21 19:07 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-16 4:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113031
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:
https://gcc.gnu.org/g:39f9c426f58448d6df340cdccd84e05721a20921
commit r14-6619-g39f9c426f58448d6df340cdccd84e05721a20921
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date: Sat Dec 16 10:59:03 2023 +1100
c++: Fix unchecked use of CLASSTYPE_AS_BASE [PR113031]
My previous commit (naively) assumed that a TREE_CODE of RECORD_TYPE or
UNION_TYPE was sufficient for optype to be considered a "class type".
However, this does not account for e.g. template type parameters of
record or union type. This patch corrects to check for CLASS_TYPE_P
before checking for as-base conversion.
PR c++/113031
gcc/cp/ChangeLog:
* constexpr.cc (cxx_fold_indirect_ref_1): Check for CLASS_TYPE
before using CLASSTYPE_AS_BASE.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/pr113031.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/113031] [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508
2023-12-15 11:22 [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508 redi at gcc dot gnu.org
` (4 preceding siblings ...)
2023-12-16 4:11 ` cvs-commit at gcc dot gnu.org
@ 2023-12-21 19:07 ` jakub at gcc dot gnu.org
2023-12-22 0:52 ` nathanieloshead at gmail dot com
2023-12-22 0:55 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-21 19:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113031
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So fixed?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/113031] [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508
2023-12-15 11:22 [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508 redi at gcc dot gnu.org
` (5 preceding siblings ...)
2023-12-21 19:07 ` jakub at gcc dot gnu.org
@ 2023-12-22 0:52 ` nathanieloshead at gmail dot com
2023-12-22 0:55 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: nathanieloshead at gmail dot com @ 2023-12-22 0:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113031
--- Comment #6 from Nathaniel Shead <nathanieloshead at gmail dot com> ---
Yes, fixed as far as I'm aware.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/113031] [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508
2023-12-15 11:22 [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508 redi at gcc dot gnu.org
` (6 preceding siblings ...)
2023-12-22 0:52 ` nathanieloshead at gmail dot com
@ 2023-12-22 0:55 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-22 0:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113031
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-12-22 0:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15 11:22 [Bug c++/113031] New: [14 Regression] ICE in cxx_fold_indirect_ref_1 starting with r14-6508 redi at gcc dot gnu.org
2023-12-15 11:26 ` [Bug c++/113031] " redi at gcc dot gnu.org
2023-12-15 12:52 ` rguenth at gcc dot gnu.org
2023-12-15 13:52 ` nathanieloshead at gmail dot com
2023-12-15 13:53 ` redi at gcc dot gnu.org
2023-12-16 4:11 ` cvs-commit at gcc dot gnu.org
2023-12-21 19:07 ` jakub at gcc dot gnu.org
2023-12-22 0:52 ` nathanieloshead at gmail dot com
2023-12-22 0:55 ` jakub 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).