https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95523
Bug ID: 95523 Summary: aarch64:ICE in register_tuple_type,at config/aarch64/aarch64-sve-builtins.cc:3434 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: z.zhanghaijian at huawei dot com Target Milestone: --- ICE issue triggered under option -fpack-struct=n: Example: test.c: #include "arm_sve.h" gcc test.c -S -fpack-struct=2 In file included from test.c:1: lib/gcc/aarch64-linux-gnu/11.0.0/include/arm_sve.h:40:9: internal compiler error: in register_tuple_type, at config/aarch64/aarch64-sve-builtins.cc:3434 40 | #pragma GCC aarch64 "arm_sve.h" | ^~~ 0x17ef8b3 register_tuple_type ../.././gcc/config/aarch64/aarch64-sve-builtins.cc:3434 0x17f00ff aarch64_sve::handle_arm_sve_h() ../.././gcc/config/aarch64/aarch64-sve-builtins.cc:3516 0xae927f aarch64_pragma_aarch64 ../.././gcc/config/aarch64/aarch64-c.c:281 0xaafe53 c_invoke_pragma_handler(unsigned int) ../.././gcc/c-family/c-pragma.c:1501 0x9f6133 c_parser_pragma ../.././gcc/c/c-parser.c:12509 0x9dc03f c_parser_external_declaration ../.././gcc/c/c-parser.c:1726 0x9dbb43 c_parser_translation_unit ../.././gcc/c/c-parser.c:1618 0xa14a23 c_parse_file() ../.././gcc/c/c-parser.c:21746 0xaa7ed3 c_common_parse_file() ../.././gcc/c-family/c-opts.c:1190 The #pragma GCC aarch64 "arm_sve.h" will tell GCC to insert the necessary type and function definitions. When register the tuple type, the function register_tuple_type will check TYPE_ALIGN (tuple_type) == 128. The option -fpack-struct=n will change the alignment of the tuple. When -fpack-struct=2, the value of TYPE_ALIGN (tuple_type) is 16, which will cause ICE. I think there is no need to judge TYPE_ALIGN, even if type_mode is SVE vector. Any questions? Proposed patch: diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index bdb04e8170d..5bc5af91016 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -3432,8 +3432,7 @@ register_tuple_type (unsigned int num_vectors, vector_type_index type) make_type_sizeless (tuple_type); layout_type (tuple_type); gcc_assert (VECTOR_MODE_P (TYPE_MODE (tuple_type)) - && TYPE_MODE_RAW (tuple_type) == TYPE_MODE (tuple_type) - && TYPE_ALIGN (tuple_type) == 128); + && TYPE_MODE_RAW (tuple_type) == TYPE_MODE (tuple_type)); /* Work out the structure name. */ char buffer[sizeof ("svbfloat16x4_t")];