https://gcc.gnu.org/g:4990533b6a10301ff4681fbcc0bbe7c32ca819fe
commit r17-5005-g4990533b6a10301ff4681fbcc0bbe7c32ca819fe Author: Uros Bizjak <[email protected]> Date: Thu Oct 8 12:18:03 2026 +0200 testsuite: Add testcase for already fixed PR [PR127743] This testcase got fixed with r17-3273. Add x86 specific testcase. PR rtl-optimization/127743 gcc/testsuite/ChangeLog: * g++.target/i386/pr127743.C: New test. Diff: --- gcc/testsuite/g++.target/i386/pr127743.C | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gcc/testsuite/g++.target/i386/pr127743.C b/gcc/testsuite/g++.target/i386/pr127743.C new file mode 100644 index 000000000000..db04d287bc0e --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr127743.C @@ -0,0 +1,27 @@ +// PR rtl-optimization/127743 +// { dg-do run { target sse2_runtime } } +// { dg-options "-O2 -msse2" } +// { dg-require-effective-target c++11 } + +#include <vector> + +struct C { _Float16 re, im; }; + +[[gnu::noinline]] std::vector<C> conv(const std::vector<C>& p, float s) { + std::vector<C> half; + half.reserve(p.size() + 1); + half.push_back({p.front().re, 0}); + for (unsigned k = 1; k < p.size(); ++k) + half.push_back({(_Float16)((float)p[k].re * s), p[k].im}); + half.push_back({p.front().im, 0}); // <-- this store; im must be 0 + return half; +} + +int main() { + std::vector<C> y(2); + y[0] = {(_Float16)0.5f, (_Float16)0.5f}; + y[1] = {(_Float16)0.5f, (_Float16)0.0f}; + std::vector<C> r = conv(y, 1234.5f); + if (r.back().im != 0) + __builtin_abort(); +}
