https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83789
Bug ID: 83789 Summary: __builtin_altivec_lvx fails for powerpc for altivec-4.c Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kaushik.phatak at kpitcummins dot com Target Milestone: --- Regression testcase gcc.target/powerpc/altivec-4.c fails for powerpc gcc-7 onwards. $powerpc-linux-gcc -m32 -mhard-float -maltivec altivec-4.c -c min.c: In function 'b': min.c:16:7: internal compiler error: Segmentation fault i = __builtin_altivec_lvx (int1, pi); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0x85d8690 crash_signal /home/kaushikp/toolchain/powerpc/linux_build_71/../src/gcc-7.1.0/gcc/toplev.c:337 0x832f525 store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool, tree_node*) /home/kaushikp/toolchain/powerpc/linux_build_71/../src/gcc-7.1.0/gcc/expr.c:5575 0x8330c91 expand_assignment(tree_node*, tree_node*, bool) /home/kaushikp/toolchain/powerpc/linux_build_71/../src/gcc-7.1.0/gcc/expr.c:5321 0x823bb98 expand_call_stmt /home/kaushikp/toolchain/powerpc/linux_build_71/../src/gcc-7.1.0/gcc/cfgexpand.c:2656 0x823bb98 expand_gimple_stmt_1 /home/kaushikp/toolchain/powerpc/linux_build_71/../src/gcc-7.1.0/gcc/cfgexpand.c:3571 0x823bb98 expand_gimple_stmt /home/kaushikp/toolchain/powerpc/linux_build_71/../src/gcc-7.1.0/gcc/cfgexpand.c:3737 0x823cbd0 expand_gimple_basic_block /home/kaushikp/toolchain/powerpc/linux_build_71/../src/gcc-7.1.0/gcc/cfgexpand.c:5744 0x8241e36 execute /home/kaushikp/toolchain/powerpc/linux_build_71/../src/gcc-7.1.0/gcc/cfgexpand.c:6357 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions The builtin generates the 'CODE_FOR_altivec_lvx_v4si_2op' instruction which returns CODE_FOR_nothing resulting in Segmentation fault. The pattern 'CODE_FOR_altivec_lvx_v4si_2op' was introduced by the following patch I believe, https://gcc.gnu.org/ml/gcc-patches/2016-04/msg01110.html The pattern tests for TARGET_64BIT and the testcase passes for powerpc64, however fails for 32-bit targets. This passed in GCC-6 and earlier branches. Should we modify the testcase so it runs only for 64-bit targets, or should this builtin work for 32-bit targets as well?