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

            Bug ID: 110487
           Summary: invalid wide Boolean value
           Product: gcc
           Version: 14.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 vrp2 pass generates IR where a <signed-boolean:32> may get the value 1 (in
addition to the valid 0 and -1).

This can be seen in gcc.c-torture/compile/pr53410-1.c

  int *a, b, c, d;

  void
  foo (void)
  {
    for (; d <= 0; d++)
      b &= ((a || d) ^ c) == 1;
  }

when compiled as "gcc -O3". The vectorizer has created (correct) code

  _Bool _16;
  <signed-boolean:32> _66;
  ...
  _16 = a.1_1 != 0B;
  _66 = _16 ? -1 : 0;

which then is transformed by vrp2 to

  _Bool _16;
  <signed-boolean:32> _38;
  <signed-boolean:32> _66;
  ...
  _16 = a.1_1 != 0B;
  _38 = (<signed-boolean:32>) _16;
  _66 = -_38;

_16 can be both true/false depending on the values of some global variables, so
_38 has the value 0 or -1, and _66 has the value 0 or 1.

Reply via email to