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

            Bug ID: 128609
           Summary: ICE in build_vector_from_ctor caused by _Literal of
                    vector type with too many initialisers
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Chris.Bazley at arm dot com
  Target Milestone: ---

Sample code that reproduces the problem:

typedef unsigned char Type __attribute__ ((vector_size (16)));

Type
__GIMPLE (startwith ("expand")) foo (void)
{
  Type v;

  v = _Literal (Type){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17};

  return v;
}


Command line used to invoke GCC:

/work/gcc/build-debug/gcc/xgcc     -B/work/gcc/build-debug/gcc/     -O2
-fgimple     -march=armv8.2-a  -Wall -Wextra -fdump-tree-gimple   -S
test-gimple.c -o test-gimple.s


Version of GCC tested:

Target: aarch64-unknown-linux-gnu
Configured with: ../configure --disable-bootstrap --enable-checking=yes
--disable-multilib CFLAGS='-g -O0' CXXFLAGS='-g -O0'
--enable-languages=c,c++,lto --no-create --no-recursion : (reconfigured)
../configure --disable-bootstrap --enable-checking=yes --disable-multilib
CFLAGS='-g -O0' CXXFLAGS='-g -O0' --enable-languages=c,c++,lto --no-create
--no-recursion
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20261106 (experimental) (GCC) 


Expected vs. actual behaviour:

At worst, I expected a diagnostic message about the excess initialisers.  The
actual behaviour is a crash with a stack backtrace:

test-gimple.c: In function ‘foo’:
test-gimple.c:8:3: internal compiler error: in build_vector_from_ctor, at
tree.cc:2215
    8 |   v = _Literal (Type){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17};
      |   ^
0x3e4addb internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:787
0x3e5a6df fancy_abort(char const*, int, char const*)
        ../../gcc/diagnostics/context.cc:1813
0x215a96f build_vector_from_ctor(tree_node*, vec<constructor_elt, va_gc,
vl_embed> const*)
        ../../gcc/tree.cc:2215
0x11bfc8f c_parser_gimple_postfix_expression
        ../../gcc/c/gimple-parser.cc:1867
0x11bc7d3 c_parser_gimple_binary_expression
        ../../gcc/c/gimple-parser.cc:1043
0x11bc467 c_parser_gimple_statement
        ../../gcc/c/gimple-parser.cc:955
0x11bb447 c_parser_gimple_compound_statement
        ../../gcc/c/gimple-parser.cc:729
0x11b99db c_parser_parse_gimple_body(c_parser*, char*, c_declspec_il,
profile_count)
        ../../gcc/c/gimple-parser.cc:297
0x114e1db c_parser_declaration_or_fndef
        ../../gcc/c/c-parser.cc:3368
0x114b69f c_parser_external_declaration
        ../../gcc/c/c-parser.cc:2276
0x114ae87 c_parser_translation_unit
        ../../gcc/c/c-parser.cc:2115
0x11ac2bb c_parse_file()
        ../../gcc/c/c-parser.cc:31603
0x128e89f c_common_parse_file()
        ../../gcc/c-family/c-opts.cc:1442
/work/gcc/build-debug/gcc/cc1 -quiet -imultiarch aarch64-linux-gnu -iprefix
/work/gcc/build-debug/gcc/../lib/gcc/aarch64-unknown-linux-gnu/17.0.0/ -isystem
/work/gcc/build-debug/gcc/include -isystem
/work/gcc/build-debug/gcc/include-fixed test-gimple.c
-mno-fix-cortex-a53-835769 -mno-fix-cortex-a53-843419 -quiet -dumpbase
test-gimple.c -dumpbase-ext .c -march=armv8.2-a -mlittle-endian -mabi=lp64 -O2
-Wall -Wextra -fgimple -fdump-tree-gimple -o test-gimple.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to