https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99381
Bug ID: 99381 Summary: SVE: ICE with ACLE intrinsics when missing -march=armv8.2-a+sve Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- For the following C testcase: #include <arm_sve.h> _Bool a; int main() { a = svaddv(svptrue_b8(), svdup_s8(0)); } we ICE while printing a diagnostic if the -march=armv8.2-a+sve flag is omitted: $ aarch64-linux-gnu-gcc -c test.c test.c: In function ‘main’: test.c:3:25: error: ACLE function ‘svptrue_b8’ requires ISA extension ‘sve’ 3 | int main() { a = svaddv(svptrue_b8(), svdup_s8(0)); } | ^~~~~~~~~~ test.c:3:25: note: you can enable ‘sve’ using the command-line option ‘-march’, or by using the ‘target’ attribute or pragma ‘ in print_type, at c/c-objc-common.c:188 3 | int main() { a = svaddv(svptrue_b8(), svdup_s8(0)); } | ^~~ 0x741fee print_type /home/alecop01/toolchain/src/gcc/gcc/c/c-objc-common.c:188 0x74237b c_tree_printer /home/alecop01/toolchain/src/gcc/gcc/c/c-objc-common.c:310 0x1c518a0 pp_format(pretty_printer*, text_info*) /home/alecop01/toolchain/src/gcc/gcc/pretty-print.c:1475 0x1c33829 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) /home/alecop01/toolchain/src/gcc/gcc/diagnostic.c:1244 0x1c33d3a diagnostic_impl /home/alecop01/toolchain/src/gcc/gcc/diagnostic.c:1406 0x1c34813 error_at(unsigned int, char const*, ...) /home/alecop01/toolchain/src/gcc/gcc/diagnostic.c:1729 0x12c1a59 aarch64_sve::function_resolver::require_vector_type(unsigned int, aarch64_sve::vector_type_index) /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64-sve-builtins.cc:1472 0x12c20c2 aarch64_sve::function_resolver::check_gp_argument(unsigned int, unsigned int&, unsigned int&) /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64-sve-builtins.cc:2132 0x12c82dd aarch64_sve::function_resolver::resolve_uniform(unsigned int, unsigned int) /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64-sve-builtins.cc:2273 0x12cbeb7 aarch64_sve::reduction_wide_def::resolve(aarch64_sve::function_resolver&) const /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc:2393 0x12c20e6 aarch64_sve::function_resolver::resolve() /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64-sve-builtins.cc:2321 0x12c63fe aarch64_sve::resolve_overloaded_builtin(unsigned int, unsigned int, vec<tree_node*, va_gc, vl_embed>*) /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64-sve-builtins.cc:3565 0x825c46 aarch64_resolve_overloaded_builtin /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64-c.c:322 0x7c14a6 resolve_overloaded_builtin(unsigned int, tree_node*, vec<tree_node*, va_gc, vl_embed>*) /home/alecop01/toolchain/src/gcc/gcc/c-family/c-common.c:7598 0x729cca c_build_function_call_vec(unsigned int, vec<unsigned int, va_heap, vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc, vl_embed>*) /home/alecop01/toolchain/src/gcc/gcc/c/c-typeck.c:3210 0x758769 c_parser_postfix_expression_after_primary /home/alecop01/toolchain/src/gcc/gcc/c/c-parser.c:10464 0x74c1de c_parser_postfix_expression /home/alecop01/toolchain/src/gcc/gcc/c/c-parser.c:10137 0x754f1f c_parser_unary_expression /home/alecop01/toolchain/src/gcc/gcc/c/c-parser.c:8227 0x754fff c_parser_cast_expression /home/alecop01/toolchain/src/gcc/gcc/c/c-parser.c:8066 0x755276 c_parser_binary_expression /home/alecop01/toolchain/src/gcc/gcc/c/c-parser.c:7869 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. Notably the problem doesn't occur for the analogous C++ testcase: #include <arm_sve.h> bool a; int main() { a = svaddv(svptrue_b8(), svdup_s8(0)); } or for the C testcase if we use the specialised version of svaddv (instead of the overload): #include <arm_sve.h> _Bool a; int main() { a = svaddv_s8(svptrue_b8(), svdup_s8(0)); }