gcc-14 bug compiling test/arm/neon/ext.cpp on x86
Opened this issue · 6 comments
When compiling simde with gcc 14.2.1 on i586 I get the following error:
[1561/4004] Compiling C++ object test/arm/neon/ext-emul-cpp.p/meson-generated_.._ext.cpp.o
FAILED: test/arm/neon/ext-emul-cpp.p/meson-generated_.._ext.cpp.o
c++ -Itest/arm/neon/ext-emul-cpp.p -Itest/arm/neon -I../test/arm/neon -I. -I.. -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto -march=i586 -mtune=generic -fopenmp-simd -DSIMDE_CONSTRAINED_COMPILATION -DSIMDE_ENABLE_OPENMP -Wno-psabi -DSIMDE_TEST_BARE -DSIMDE_NO_NATIVE -ffloat-store -MD -MQ test/arm/neon/ext-emul-cpp.p/meson-generated_.._ext.cpp.o -MF test/arm/neon/ext-emul-cpp.p/meson-generated_.._ext.cpp.o.d -o test/arm/neon/ext-emul-cpp.p/meson-generated_.._ext.cpp.o -c test/arm/neon/ext.cpp
during GIMPLE pass: local-fnsummary
In file included from test/arm/neon/ext.cpp:2235:
../test/arm/neon/test-neon-footer.h: In function ‘simde_vext_p64’:
../test/arm/neon/test-neon-footer.h:17:3: internal compiler error: in predicate_for_phi_result, at ipa-fnsummary.cc:2447
17 | }
| ^
0x8fcfced internal_error(char const*, ...)
???:0
0x8fcfdc2 fancy_abort(char const*, int, char const*)
???:0
0x92f057c compute_fn_summary(cgraph_node*, bool)
???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
The bug occurs only with -O2 or -O3 in function simde_vext_p64
specifically in simde/arm/neon/ext.h:967, when assigning destination vector values:
r_.values[i] = (src < (sizeof(r_.values) / sizeof(r_.values[0]))) ? a_.values[src] : b_.values[src & 0];
Simply reversing the condition fixes the issue:
r_.values[i] = (src >= (sizeof(r_.values) / sizeof(r_.values[0]))) ? b_.values[src & 0] : a_.values[src];
Thank you @Blarse for the report. Did you file an issue in the GCC bug tracker?
Not yet actually, as I found this with our ALT Linux gcc ("i586-alt-linux-gcc (GCC) 14.2.1 20241028 (ALT Sisyphus 14.2.1-alt1)") and still wasn't able to test if this bug occurs on other systems. If you have an i586 system with gcc-14 at hand, I would appreciate it if you could confirm this error.
I'm also trying to create a small and independent from simde reproducer.
If you think it's better to report this right now without additional analysis, then I'll do it.
I've written a minimal reproducer.
Also I was able to reproduce this bug in debian experimental container with gcc (Debian 14.2.0-11) 14.2.0
#include "stdint.h"
#include "stddef.h"
typedef uint64_t poly64x1 __attribute__((__vector_size__(8)));
poly64x1 vext_p64(poly64x1 a, poly64x1 b, const int n)
{
poly64x1 r = a;
size_t src = ((size_t) (n));
r[0] = (src < 1) ? a[src] : b[0];
return r;
}
$ gcc -O2 -c ./reproducer.c
during GIMPLE pass: local-fnsummary
./reproducer.c: In function 'vext_p64':
./reproducer.c:12:1: internal compiler error: in predicate_for_phi_result, at ipa-fnsummary.cc:2447
12 | }
| ^
0x9133008 internal_error(char const*, ...)
???:0
0x91330d2 fancy_abort(char const*, int, char const*)
???:0
0x9291277 compute_fn_summary(cgraph_node*, bool)
???: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.
$ gcc -O1 -c ./reproducer.c
during GIMPLE pass: uncprop
./reproducer.c: In function 'vext_p64':
./reproducer.c:6:10: internal compiler error: in promote_ssa_mode, at explow.cc:923
6 | poly64x1 vext_p64(poly64x1 a, poly64x1 b, const int n)
| ^~~~~~~~
0x9133008 internal_error(char const*, ...)
???:0
0x91330d2 fancy_abort(char const*, int, char const*)
???:0
0x93bf7d9 gimple_can_coalesce_p(tree_node*, tree_node*)
???:0
0x944fe9d uncprop_dom_walker::before_dom_children(basic_block_def*)
???:0
0x958ed71 dom_walker::walk(basic_block_def*)
???: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.
Now I will create an issue in the GCC bug tracker.
That's great, thank you @Blarse . We can add the GCC bug number to https://github.com/simd-everywhere/simde/wiki/Compiler-Bugs
Turned out that it is not so easy to create an account on https://gcc.gnu.org/bugzilla. Hope they will answer me soon and I will be able to create a bug.
Turned out that it is not so easy to create an account on https://gcc.gnu.org/bugzilla. Hope they will answer me soon and I will be able to create a bug.
No worries, it took me a while too. If you want, you can send me the bug text and I'll post it (giving you credit). Or we can wait for your account to be approved. Either is fine by me