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

            Bug ID: 121014
           Summary: vectorizer uses RDIV_EXPR for integer types
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kristerw at gcc dot gnu.org
  Target Milestone: ---

The function vect_get_loop_len in tree-vect-loop.cc uses RDIV_EXPR for integer
calculations. This is incorrect, as RDIV_EXPR is only supposed to be used for
floating-point types according to tree.def.

The generation of an integer RDIV_EXPR can be seen when compiling the following
function for RISC-V with -O3 -march=rv64gcbv

#include <stdint.h>
void
foo0 (int8_t *f, int16_t *d, int n)
{
  for (int i = 0; i < n; ++i)
    {
      f[i * 2 + 0] = 1;
      f[i * 2 + 1] = 2;
      d[i] = 3;
    }
}

Reply via email to