public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/107242] New: ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284
@ 2022-10-13 4:12 asolokha at gmx dot com
2022-10-13 5:01 ` [Bug c++/107242] " pinskia at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: asolokha at gmx dot com @ 2022-10-13 4:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107242
Bug ID: 107242
Summary: ICE: tree check: expected complex_cst, have plus_expr
in output_constant, at varasm.cc:5284
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
Target Milestone: ---
Target: powerpc-e300c3-linux-gnu
g++ 13.0.0 20221009 snapshot (g:e95e91eccd022a4a3a86da2749809fbad9afd20e) ICEs
when compiling the following testcase, reduced from
libstdc++-v3/testsuite/26_numerics/complex/comparison_operators/more_constexpr.cc,
for a 32-bit BE target w/ -std=c++20 -Og -frounding-math -fno-ipa-pure-const:
#include <complex>
std::complex<float>
test_comparison ()
{
constexpr std::complex<float> a{1.1, 2.2};
constexpr std::complex<float> b{3.3, 4.4};
return a + b;
}
% powerpc-e300c3-linux-gnu-g++-13 -std=c++20 -Og -frounding-math
-fno-ipa-pure-const -c micz0onj.cc
micz0onj.cc:10:1: internal compiler error: tree check: expected complex_cst,
have plus_expr in output_constant, at varasm.cc:5284
10 | }
| ^
0x803d1f tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/tree.cc:8827
0x819d94 tree_check(tree_node*, char const*, int, char const*, tree_code)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/tree.h:3526
0x819d94 output_constant
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:5284
0x14b1c1a output_constructor_regular_field
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:5562
0x14b1c1a output_constructor
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:5829
0x14b3625 assemble_constant_contents
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:3638
0x14b3d34 output_object_block
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:8070
0x14b3d34 output_object_blocks()
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:8148
powerpc-e300c3-linux-gnu-g++-13 -v
Using built-in specs.
COLLECT_GCC=powerpc-e300c3-linux-gnu-g++-13
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/powerpc-e300c3-linux-gnu/13/lto-wrapper
Target: powerpc-e300c3-linux-gnu
Configured with:
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/configure
--host=x86_64-pc-linux-gnu --target=powerpc-e300c3-linux-gnu
--build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/powerpc-e300c3-linux-gnu/gcc-bin/13
--includedir=/usr/lib/gcc/powerpc-e300c3-linux-gnu/13/include
--datadir=/usr/share/gcc-data/powerpc-e300c3-linux-gnu/13
--mandir=/usr/share/gcc-data/powerpc-e300c3-linux-gnu/13/man
--infodir=/usr/share/gcc-data/powerpc-e300c3-linux-gnu/13/info
--with-gxx-include-dir=/usr/lib/gcc/powerpc-e300c3-linux-gnu/13/include/g++-v13
--with-python-dir=/share/gcc-data/powerpc-e300c3-linux-gnu/13/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --disable-nls
--disable-libunwind-exceptions --enable-checking=yes
--with-gcc-major-version-only --disable-esp --enable-libstdcxx-time
--disable-libstdcxx-pch --enable-poison-system-directories
--with-sysroot=/usr/powerpc-e300c3-linux-gnu --disable-bootstrap
--enable-__cxa_atexit --enable-clocale=gnu --disable-multilib
--disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp
--disable-libada --disable-cet --disable-systemtap
--enable-valgrind-annotations --disable-vtable-verify --disable-libvtv
--without-zstd --enable-lto --with-isl --disable-isl-version-check
--disable-libsanitizer --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221009 (experimental) (GCC)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107242] ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284
2022-10-13 4:12 [Bug target/107242] New: ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 asolokha at gmx dot com
@ 2022-10-13 5:01 ` pinskia at gcc dot gnu.org
2022-10-13 5:06 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-13 5:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107242
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is the gimplification which is causing issues.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107242] ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284
2022-10-13 4:12 [Bug target/107242] New: ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 asolokha at gmx dot com
2022-10-13 5:01 ` [Bug c++/107242] " pinskia at gcc dot gnu.org
@ 2022-10-13 5:06 ` pinskia at gcc dot gnu.org
2022-10-13 5:17 ` [Bug c++/107242] ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 with frounding-math asolokha at gmx dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-13 5:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107242
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
From the original dump:
{
const struct complex a = {._M_value=__complex__
(1.10000002384185791015625e+0, 2.2000000476837158203125e+0)};
const struct complex b = {._M_value=__complex__ (3.2999999523162841796875e+0,
4.400000095367431640625e+0)};
<<cleanup_point const struct complex a = {._M_value=__complex__
(1.10000002384185791015625e+0, 2.2000000476837158203125e+0)};>>;
<<cleanup_point const struct complex b = {._M_value=__complex__
(3.2999999523162841796875e+0, 4.400000095367431640625e+0)};>>;
<<cleanup_point return <retval> = TARGET_EXPR <D.68654, TARGET_EXPR <D.68676,
{._M_value=__complex__ (1.10000002384185791015625e+0,
2.2000000476837158203125e+0) + __complex__ (3.2999999523162841796875e+0,
4.400000095367431640625e+0)}>>>>;
}
Which looks fine as we have COMPLEX_CST+COMPLEX_CST
But then in the gimple dump we get:
<retval> = *.LC2D.78102;
Which is broken.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107242] ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 with frounding-math
2022-10-13 4:12 [Bug target/107242] New: ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 asolokha at gmx dot com
2022-10-13 5:01 ` [Bug c++/107242] " pinskia at gcc dot gnu.org
2022-10-13 5:06 ` pinskia at gcc dot gnu.org
@ 2022-10-13 5:17 ` asolokha at gmx dot com
2022-10-13 5:25 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: asolokha at gmx dot com @ 2022-10-13 5:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107242
--- Comment #3 from Arseny Solokha <asolokha at gmx dot com> ---
Testcase w/o dependency on libstdc++:
template <typename>
class complex;
template <>
struct complex<float> {
template <typename _Tp>
constexpr void
operator+= (_Tp __z)
{
_M_value += __z._M_value;
}
_Complex float _M_value;
};
constexpr complex<float>
operator+ (complex<float> __x, complex<float> __y)
{
complex __r = __x;
__r += __y;
return __r;
}
complex<float>
test_comparison ()
{
constexpr complex<float> a{2.2}, b{4.4};
return a + b;
}
% powerpc-e300c3-linux-gnu-g++-13 -Og -frounding-math -c micz0onj.cc
micz0onj.cc:32:1: internal compiler error: tree check: expected complex_cst,
have plus_expr in output_constant, at varasm.cc:5284
32 | }
| ^
0x803d1f tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/tree.cc:8827
0x819d94 tree_check(tree_node*, char const*, int, char const*, tree_code)
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/tree.h:3526
0x819d94 output_constant
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:5284
0x14b1c1a output_constructor_regular_field
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:5562
0x14b1c1a output_constructor
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:5829
0x14b3625 assemble_constant_contents
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:3638
0x14b3d34 output_object_block
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:8070
0x14b3d34 output_object_blocks()
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/varasm.cc:8148
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107242] ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 with frounding-math
2022-10-13 4:12 [Bug target/107242] New: ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 asolokha at gmx dot com
` (2 preceding siblings ...)
2022-10-13 5:17 ` [Bug c++/107242] ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 with frounding-math asolokha at gmx dot com
@ 2022-10-13 5:25 ` pinskia at gcc dot gnu.org
2022-10-14 7:24 ` rguenth at gcc dot gnu.org
2022-10-14 19:41 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-13 5:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107242
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-10-13
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Arseny Solokha from comment #3)
> Testcase w/o dependency on libstdc++:
And reduced all the way:
struct cf {
_Complex float _M_value;
};
cf
test_comparison ()
{
constexpr _Complex float a{2.2}, b{4.4};
return {a + b};
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107242] ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 with frounding-math
2022-10-13 4:12 [Bug target/107242] New: ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 asolokha at gmx dot com
` (3 preceding siblings ...)
2022-10-13 5:25 ` pinskia at gcc dot gnu.org
@ 2022-10-14 7:24 ` rguenth at gcc dot gnu.org
2022-10-14 19:41 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-14 7:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107242
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think that either the C++ frontend needs to reject this code or we need to
ignore -frounding-math in constant folding this (I think we do that elsewhere).
x86 is fine, presumambly because of ... !?
I get
struct cf test_comparison ()
{
struct cf D.2394;
const complex float a;
const complex float b;
a = __complex__ (2.2000000476837158203125e+0, 0.0);
b = __complex__ (4.400000095367431640625e+0, 0.0);
_1 = __complex__ (2.2000000476837158203125e+0, 0.0) + __complex__
(4.400000095367431640625e+0, 0.0);
D.2394._M_value = _1;
return D.2394;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107242] ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 with frounding-math
2022-10-13 4:12 [Bug target/107242] New: ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 asolokha at gmx dot com
` (4 preceding siblings ...)
2022-10-14 7:24 ` rguenth at gcc dot gnu.org
@ 2022-10-14 19:41 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-14 19:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107242
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #5)
> I think that either the C++ frontend needs to reject this code or we need to
> ignore -frounding-math in constant folding this (I think we do that
> elsewhere).
>
> x86 is fine, presumambly because of ... !?
Because of the gimplifier deciding it should do the complex float move struct
by peices rather than a block.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-10-14 19:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13 4:12 [Bug target/107242] New: ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 asolokha at gmx dot com
2022-10-13 5:01 ` [Bug c++/107242] " pinskia at gcc dot gnu.org
2022-10-13 5:06 ` pinskia at gcc dot gnu.org
2022-10-13 5:17 ` [Bug c++/107242] ICE: tree check: expected complex_cst, have plus_expr in output_constant, at varasm.cc:5284 with frounding-math asolokha at gmx dot com
2022-10-13 5:25 ` pinskia at gcc dot gnu.org
2022-10-14 7:24 ` rguenth at gcc dot gnu.org
2022-10-14 19:41 ` pinskia 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).