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

            Bug ID: 125621
           Summary: ICE in build_poly_int_cst with SVE svcntd () and
                    -fsanitize=undefined
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following fails:

$ cat t.c
#pragma GCC aarch64 "arm_sve.h"
long foo(int y) {
  long x = svcntd();
  return x * y;
}
$ ./xgcc -B . -c -S -o /dev/null t.c -march=armv8.2-a+sve -O2
-fsanitize=undefined
during RTL pass: expand
t.c: In function ‘foo’:
t.c:4:12: internal compiler error: tree check: expected class ‘type’, have
‘declaration’ (var_decl) in build_poly_int_cst, at tree.cc:1984
    4 |   return x * y;
      |          ~~^~~
0x433d400 internal_error(char const*, ...)
        /fast/trunk/src/gcc/gcc/diagnostic-global-context.cc:787
0x21a0431 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        /fast/trunk/src/gcc/gcc/tree.cc:9269
0x104982f tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        /fast/trunk/src/gcc/gcc/tree.h:3947
0x2181b82 build_poly_int_cst(tree_node*, poly_int<2u,
generic_wide_int<wide_int_ref_storage<false, true> > > const&)
        /fast/trunk/src/gcc/gcc/tree.cc:1984
0x2181e21 wide_int_to_tree(tree_node*, poly_int<2u,
generic_wide_int<wide_int_ref_storage<false, true> > > const&)
        /fast/trunk/src/gcc/gcc/tree.cc:2012
0x151f7b0 make_tree(tree_node*, rtx_def*)
        /fast/trunk/src/gcc/gcc/expmed.cc:5512
0x1783b5a expand_mul_overflow
        /fast/trunk/src/gcc/gcc/internal-fn.cc:2164
0x1786a74 expand_UBSAN_CHECK_MUL
        /fast/trunk/src/gcc/gcc/internal-fn.cc:2814
0x1796a5a expand_internal_call(internal_fn, gcall*)
        /fast/trunk/src/gcc/gcc/internal-fn.cc:5590
0x1796a89 expand_internal_call(gcall*)
        /fast/trunk/src/gcc/gcc/internal-fn.cc:5598
0x132bc52 expand_call_stmt
        /fast/trunk/src/gcc/gcc/cfgexpand.cc:3110
0x1330e8f expand_gimple_stmt_1
        /fast/trunk/src/gcc/gcc/cfgexpand.cc:4243
0x1331551 expand_gimple_stmt
        /fast/trunk/src/gcc/gcc/cfgexpand.cc:4390
0x1331692 expand_gimple_tailcall
        /fast/trunk/src/gcc/gcc/cfgexpand.cc:4437
0x133c109 expand_gimple_basic_block
        /fast/trunk/src/gcc/gcc/cfgexpand.cc:6480
0x133e8c5 execute
        /fast/trunk/src/gcc/gcc/cfgexpand.cc:7254
./cc1 -quiet -iprefix
/fast/builds/cc1s/dbg/aarch64/trunk/gcc/../lib/gcc/aarch64-linux-gnu/17.0.0/
-isystem ./include -isystem ./include-fixed t.c -mno-fix-cortex-a53-835769
-mno-fix-cortex-a53-843419 -quiet -dumpbase t.c -dumpbase-ext .c
-march=armv8.2-a+sve -mlittle-endian -mabi=lp64 -O2 -fsanitize=undefined -o
/dev/null
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.

It doesn't appear to be a regression, we appear to ICE going back to when the
SVE ACLE was introduced in GCC 10.

Reply via email to