public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136
@ 2023-01-06 3:09 tim at klingt dot org
2023-01-06 3:09 ` [Bug c++/108309] " tim at klingt dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: tim at klingt dot org @ 2023-01-06 3:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309
Bug ID: 108309
Summary: ICE in in cxx_eval_component_reference, at
cp/constexpr.cc:4136
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tim at klingt dot org
Target Milestone: ---
```
template <typename _Tp> constexpr _Tp forward(_Tp &__t) {
return static_cast<_Tp &&>(__t);
}
struct _Enable_copy_move {};
struct optional;
template <int _Nm> struct __array_traits { typedef optional _Type[_Nm]; };
template <int _Nm> struct array { __array_traits<_Nm>::_Type _M_elems; };
struct _Optional_payload_base {
union {
int _M_value;
};
};
struct _Optional_base {
constexpr _Optional_base(...) : _M_payload() {}
constexpr _Optional_base(_Optional_base &&) {}
_Optional_payload_base _M_payload;
};
struct optional : _Optional_base, _Enable_copy_move {
using _Base = _Optional_base;
constexpr optional() {}
template <typename _Up> constexpr optional(_Up __t) : _Base(forward(__t)) {}
} page {
array<8> {}
}
```
gives me:
```
➜ scratch /usr/bin/g++-12 -std=gnu++20 testcase.ii
testcase.ii:24:1: in ‘constexpr’ expansion of
‘page.optional::optional<array<8> >(array<8>{__array_traits<8>::_Type()})’
testcase.ii:24:1: in ‘constexpr’ expansion of ‘forward(_Tp&) [with _Tp =
array<8>]()’
testcase.ii:24:1: in ‘constexpr’ expansion of ‘array<8>((*
&((array<8>&&)__t)))’
testcase.ii:24:1: in ‘constexpr’ expansion of
‘optional(<anonymous>.array<8>::_M_elems[0])’
testcase.ii:24:1: internal compiler error: in cxx_eval_component_reference, at
cp/constexpr.cc:4136
24 | }
| ^
0x7fb4eb429d8f __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7fb4eb429e3f __libc_start_main_impl
../csu/libc-start.c:392
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
```
with
```
g++-12 (Ubuntu 12.2.0-3ubuntu1~22.04) 12.2.0
Copyright (C) 2022 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.
```
unfortunately cvise didn't reduce the test case to valid c++ code (afaict
there's only a missing semicolon, though). with a trailing semicolon, gcc-11
accepts the code, but clang++-15 doesn't (not sure if it's related, but i
thought it's worth mentioning:
```
testcase.reduced.cc:21:63: error: cannot pass object of non-trivial type
'array<8>' through variadic constructor; call will abort at runtime
[-Wnon-pod-varargs]
template <typename _Up> constexpr optional(_Up __t) : _Base(forward(__t)) {}
^
testcase.reduced.cc:22:3: note: in instantiation of function template
specialization 'optional::optional<array<8>>' requested here
} page {
^
1 error generated.
```
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108309] ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136
2023-01-06 3:09 [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 tim at klingt dot org
@ 2023-01-06 3:09 ` tim at klingt dot org
2023-01-06 6:22 ` [Bug c++/108309] [12 Regression] " pinskia at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tim at klingt dot org @ 2023-01-06 3:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309
--- Comment #1 from tim blechmann <tim at klingt dot org> ---
Created attachment 54200
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54200&action=edit
reduced test case
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108309] [12 Regression] ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136
2023-01-06 3:09 [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 tim at klingt dot org
2023-01-06 3:09 ` [Bug c++/108309] " tim at klingt dot org
@ 2023-01-06 6:22 ` pinskia at gcc dot gnu.org
2023-01-06 6:31 ` tim at klingt dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-06 6:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.3
Keywords| |ice-on-valid-code,
| |needs-bisection
Known to fail| |12.2.0
Summary|ICE in in |[12 Regression] ICE in in
|cxx_eval_component_referenc |cxx_eval_component_referenc
|e, at cp/constexpr.cc:4136 |e, at cp/constexpr.cc:4136
Known to work| |11.3.0
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-01-06
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced further:
```
struct _Enable_copy_move {};
struct h {
union {
int _M_value;
};
};
struct m {
constexpr m(...) : _M_payload() {}
constexpr m(const m &) {}
h _M_payload;
};
struct optional : m, _Enable_copy_move {
constexpr optional() {}
template <typename _Up> constexpr optional(_Up __t) : m(__t) {}
};
struct array { optional t[1]; };
optional page {
array {}
};
```
>clang++-15 doesn't (not sure if it's related, but i thought it's worth mentioning:
That is a conditionally supported construct in C++. clang does not support it
but GCC does.
GCC does warn with -Wconditionally-supported :
<source>: In instantiation of 'constexpr optional::optional(_Up) [with _Up =
array]':
<source>:20:1: required from here
<source>:14:62: warning: passing objects of non-trivially-copyable type 'struct
array' through '...' is conditionally supported [-Wconditionally-supported]
14 | template <typename _Up> constexpr optional(_Up __t) : m(__t) {}
| ^
Anyways this is fixed on the trunk; though since it is a GCC 12.x regression it
will/should be fixed on the GCC 12 branch too once someone figures out which
patch fixed it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108309] [12 Regression] ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136
2023-01-06 3:09 [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 tim at klingt dot org
2023-01-06 3:09 ` [Bug c++/108309] " tim at klingt dot org
2023-01-06 6:22 ` [Bug c++/108309] [12 Regression] " pinskia at gcc dot gnu.org
@ 2023-01-06 6:31 ` tim at klingt dot org
2023-01-06 6:33 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tim at klingt dot org @ 2023-01-06 6:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309
--- Comment #3 from tim blechmann <tim at klingt dot org> ---
> That is a conditionally supported construct in C++. clang does not support it but GCC does.
>
> GCC does warn with -Wconditionally-supported
interesting. i may have to reduce it manually rather than going through cvise:
the real-world code builds with clang and gcc doesn't seem to emit a warning
with -Wconditionally-supported
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108309] [12 Regression] ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136
2023-01-06 3:09 [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 tim at klingt dot org
` (2 preceding siblings ...)
2023-01-06 6:31 ` tim at klingt dot org
@ 2023-01-06 6:33 ` pinskia at gcc dot gnu.org
2023-01-06 11:30 ` marxin at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-06 6:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to tim blechmann from comment #3)
> > That is a conditionally supported construct in C++. clang does not support it but GCC does.
> >
> > GCC does warn with -Wconditionally-supported
>
> interesting. i may have to reduce it manually rather than going through
> cvise: the real-world code builds with clang and gcc doesn't seem to emit a
> warning with -Wconditionally-supported
Or you could add -Werror=conditionally-supported as an option and reduce it
that way ...
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108309] [12 Regression] ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136
2023-01-06 3:09 [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 tim at klingt dot org
` (3 preceding siblings ...)
2023-01-06 6:33 ` pinskia at gcc dot gnu.org
@ 2023-01-06 11:30 ` marxin at gcc dot gnu.org
2023-01-06 17:25 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-06 11:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-bisection |
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master with r13-963-gd19b4342c19e5a7f and it started with
r12-2304-ga42f8120442cf3ba.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108309] [12 Regression] ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136
2023-01-06 3:09 [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 tim at klingt dot org
` (4 preceding siblings ...)
2023-01-06 11:30 ` marxin at gcc dot gnu.org
@ 2023-01-06 17:25 ` pinskia at gcc dot gnu.org
2023-04-27 12:06 ` rguenth at gcc dot gnu.org
2023-05-08 12:26 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-06 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=105795,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=101371
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #5)
> Fixed on master with r13-963-gd19b4342c19e5a7f
I didn't mention it when I produced the reduced testcase but removing the empty
base class does cause the ICE to go away so this looks like a real fix ...
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108309] [12 Regression] ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136
2023-01-06 3:09 [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 tim at klingt dot org
` (5 preceding siblings ...)
2023-01-06 17:25 ` pinskia at gcc dot gnu.org
@ 2023-04-27 12:06 ` rguenth at gcc dot gnu.org
2023-05-08 12:26 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-27 12:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108309] [12 Regression] ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136
2023-01-06 3:09 [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 tim at klingt dot org
` (6 preceding siblings ...)
2023-04-27 12:06 ` rguenth at gcc dot gnu.org
@ 2023-05-08 12:26 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-08 12:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.3 |12.4
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.3 is being released, retargeting bugs to GCC 12.4.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-05-08 12:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 3:09 [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 tim at klingt dot org
2023-01-06 3:09 ` [Bug c++/108309] " tim at klingt dot org
2023-01-06 6:22 ` [Bug c++/108309] [12 Regression] " pinskia at gcc dot gnu.org
2023-01-06 6:31 ` tim at klingt dot org
2023-01-06 6:33 ` pinskia at gcc dot gnu.org
2023-01-06 11:30 ` marxin at gcc dot gnu.org
2023-01-06 17:25 ` pinskia at gcc dot gnu.org
2023-04-27 12:06 ` rguenth at gcc dot gnu.org
2023-05-08 12:26 ` 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).