Followup-For: Bug #1091161
A few rounds of cvise produced this minimized reproducer:
extern "C" double copysign(double, double);
double ccosh_x;
struct type {
double x;
double y;
};
template <typename T> struct complex {
complex(T, T);
complex() = default;
T real() { return data.x; }
T imag() { return data.y; }
type data;
};
void ccosh() {
complex<double> z_;
complex(z_.real(), z_.imag() * copysign(1.0, ccosh_x));
}
(Note: this is derived from the thrust headers, not from libstdc++)
This compiles fine with g++-11/g++-12/g++-13 as found in sid/arm64, it
fails with g++-14 and g++-15.
On some quick searches ("simplify_context::simplify_subreg", "gen_xorsigndf3")
I found no corresponding upstream bug report.
# g++-14 -O2 -c 1091161.cpp
during RTL pass: expand
1091161.cpp: In function 'void ccosh()':
1091161.cpp:16:56: internal compiler error: Segmentation fault
16 | complex(z_.real(), z_.imag() * copysign(1.0, ccosh_x));
| ^
0xd81307 internal_error(char const*, ...)
???:0
0x15a6834 simplify_context::simplify_subreg(machine_mode, rtx_def*, machine_mode,
poly_int<2u, unsigned long>)
???:0
0x15a66bb simplify_context::simplify_gen_subreg(machine_mode, rtx_def*, machine_mode,
poly_int<2u, unsigned long>)
???:0
0xb02767 gen_xorsignv2df3(rtx_def*, rtx_def*, rtx_def*)
???:0
0xafbee3 gen_xorsigndf3(rtx_def*, rtx_def*, rtx_def*)
???:0
0x1608157 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
???:0
0x197fd4b expand_insn(insn_code, unsigned int, expand_operand*)
???:0
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-14/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccxoQlJv.out file, please attach this to
your bugreport.
=== BEGIN GCC DUMP ===
98041: // Target: aarch64-linux-gnu
98041: // Configured with: ../src/configure -v --with-pkgversion='Debian
14.2.0-12' --with-bugurl=file:///usr/share/doc/gcc-14/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust --prefix=/usr
--with-gcc-major-version-only --program-suffix=-14
--program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace
--enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support
--enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419
--disable-werror
--enable-offload-targets=nvptx-none=/build/reproducible-path/gcc-14-14.2.0/debian/tmp-nvptx/usr
--enable-offload-defaulted --without-cuda-driver --enable-checking=release
--build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=4
98041: // Thread model: posix
98041: // Supported LTO compression algorithms: zlib zstd
98041: // gcc version 14.2.0 (Debian 14.2.0-12)
98041: //
98041: // during RTL pass: expand
98041: // 1091161.cpp: In function 'void ccosh()':
98041: // 1091161.cpp:16:56: internal compiler error: Segmentation fault
98041: // 16 | complex(z_.real(), z_.imag() * copysign(1.0, ccosh_x));
98041: // | ^
98041: // 0xd81307 internal_error(char const*, ...)
98041: // ???:0
98041: // 0x15a6834 simplify_context::simplify_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<2u, unsigned long>)
98041: // ???:0
98041: // 0x15a66bb simplify_context::simplify_gen_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<2u, unsigned long>)
98041: // ???:0
98041: // 0xb02767 gen_xorsignv2df3(rtx_def*, rtx_def*, rtx_def*)
98041: // ???:0
98041: // 0xafbee3 gen_xorsigndf3(rtx_def*, rtx_def*, rtx_def*)
98041: // ???:0
98041: // 0x1608157 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
98041: // ???:0
98041: // 0x197fd4b expand_insn(insn_code, unsigned int, expand_operand*)
98041: // ???:0
98041: // Please submit a full bug report, with preprocessed source (by using
-freport-bug).
98041: // Please include the complete backtrace with any bug report.
98041: // See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions.
98041:
98041: // /usr/libexec/gcc/aarch64-linux-gnu/14/cc1plus -quiet -imultiarch
aarch64-linux-gnu -D_GNU_SOURCE 1091161.cpp -quiet -dumpbase 1091161.cpp
-dumpbase-ext .cpp -mlittle-endian -mabi=lp64 -O2 -fasynchronous-unwind-tables
-o - -frandom-seed=0 -fdump-noaddr
98041:
98041: # 0 "1091161.cpp"
98041: # 0 "<built-in>"
98041: # 0 "<command-line>"
98041: # 1 "/usr/include/stdc-predef.h" 1 3 4
98041: # 0 "<command-line>" 2
98041: # 1 "1091161.cpp"
98041: extern "C" double copysign(double, double);
98041: double ccosh_x;
98041: struct type {
98041: double x;
98041: double y;
98041: };
98041: template <typename T> struct complex {
98041: complex(T, T);
98041: complex() = default;
98041: T real() { return data.x; }
98041: T imag() { return data.y; }
98041: type data;
98041: };
98041: void ccosh() {
98041: complex<double> z_;
98041: complex(z_.real(), z_.imag() * copysign(1.0, ccosh_x));
98041: }
=== END GCC DUMP ===
Andreas