https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101877

            Bug ID: 101877
           Summary: [s390x] ICE: canonical types differ for identical
                    types when #pragma GCC target enables vector support
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mhillen at linux dot ibm.com
  Target Milestone: ---

When compiling C++ code on s390x where the command line arguments select an
architecture level without vectorization support (e.g., -march=zEC12) but a
#pragma GCC target upgrades to an architecture level with -mvx (e.g., pragma
GCC target("arch=z13,vx") ), I observed the following ICE:

Example code:
#include <vecintrin.h>

#pragma GCC target("arch=z13,vx")

typedef unsigned long long v2di __attribute__((vector_size(16)));

v2di bar() {
    v2di v = vec_splat_u64(0);
    return v;
}

g++ -march=zEC12 -c ~/pragma-vec2.cc 
/home/mhillen/pragma-vec2.cc: In function ‘v2di bar()’:
/home/mhillen/pragma-vec2.cc:9:29: internal compiler error: canonical types
differ for identical types ‘v2di’ {aka ‘__vector(2) long long unsigned int’}
and ‘__vector(2) long long unsigned int’
    9 |     v2di v = vec_splat_u64(0);
      |                             ^
0x155da39 comptypes(tree_node*, tree_node*, int)
        ../../gcc/cp/typeck.c:1558
0x12b58dd ocp_convert(tree_node*, tree_node*, int, int, int)
        ../../gcc/cp/cvt.c:749
0x12b7fdf convert(tree_node*, tree_node*)
        ../../gcc/cp/cvt.c:1683
0x15778ed convert_for_assignment
        ../../gcc/cp/typeck.c:9480
0x1578581 convert_for_initialization(tree_node*, tree_node*, tree_node*, int,
impl_conv_rhs, tree_node*, int, int)
        ../../gcc/cp/typeck.c:9722
0x1582407 digest_init_r
        ../../gcc/cp/typeck2.c:1251
0x15853a9 digest_init_flags(tree_node*, tree_node*, int, int)
        ../../gcc/cp/typeck2.c:1267
0x15853a9 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc/cp/typeck2.c:742
0x12d4a23 check_initializer
        ../../gcc/cp/decl.c:7185
0x1308b57 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/cp/decl.c:8119
0x144af25 cp_parser_init_declarator
        ../../gcc/cp/parser.c:22556
0x141cef5 cp_parser_simple_declaration
        ../../gcc/cp/parser.c:15088
0x141f261 cp_parser_declaration_statement
        ../../gcc/cp/parser.c:14182
0x141fb5f cp_parser_statement
        ../../gcc/cp/parser.c:12273
0x1420bbf cp_parser_statement_seq_opt
        ../../gcc/cp/parser.c:12679
0x1420d33 cp_parser_compound_statement
        ../../gcc/cp/parser.c:12628
0x14490c5 cp_parser_function_body
        ../../gcc/cp/parser.c:24762
0x14490c5 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.c:24813
0x1449f05 cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.c:30898
0x144b34f cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.c:30814
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.


Likely related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101876

Reply via email to