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

            Bug ID: 118377
           Summary: [15 Regression] ICE when using C division operator
                    with svint8 and svint16
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: soumyaa at gcc dot gnu.org
  Target Milestone: ---

When using the C division operator with svint8 and svint16 SVE ACLE vectors,
the following ICE occurs:

during GIMPLE pass: veclower
test.c: In function ‘foo’:
test.c:4:1: internal compiler error: in to_constant, at poly-int.h:592
    4 | foo (svint16_t x)
      | ^~~
0x2366fab internal_error(char const*, ...)
        ../../gcc_src/gcc/diagnostic-global-context.cc:517
0x81b1b3 fancy_abort(char const*, int, char const*)
        ../../gcc_src/gcc/diagnostic.cc:1722
0x80902f poly_int<2u, unsigned long>::to_constant() const
        ../../gcc_src/gcc/poly-int.h:592
0x130096b poly_int<2u, unsigned long>::to_constant() const
        ../../gcc_src/gcc/poly-int.h:590
0x130096b nunits_for_known_piecewise_op
        ../../gcc_src/gcc/tree-vect-generic.cc:92
0x130096b expand_vector_piecewise
        ../../gcc_src/gcc/tree-vect-generic.cc:294
0x130152b expand_vector_operation
        ../../gcc_src/gcc/tree-vect-generic.cc:1159
0x130400b expand_vector_operations_1
        ../../gcc_src/gcc/tree-vect-generic.cc:2243
0x1305e33 expand_vector_operations
        ../../gcc_src/gcc/tree-vect-generic.cc:2274
0x1305e33 execute
        ../../gcc_src/gcc/tree-vect-generic.cc:2326

Testcase (compiled with -mcpu=neoverse-v2):

#include <arm_sve.h>

svint16_t
foo (svint16_t x)
{
  return x / 4;
}

This most likely happens because SVE integer division using SDIV/UDIV is only
supported for 32-bit and 64-bit modes, and the middle-end does not have a
proper fallback if any other types are forced.

Reply via email to