public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110487] New: invalid wide Boolean value
@ 2023-06-29 19:02 kristerw at gcc dot gnu.org
  2023-06-29 19:09 ` [Bug tree-optimization/110487] " pinskia at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: kristerw at gcc dot gnu.org @ 2023-06-29 19:02 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-07-04 17:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 19:02 [Bug tree-optimization/110487] New: invalid wide Boolean value kristerw at gcc dot gnu.org
2023-06-29 19:09 ` [Bug tree-optimization/110487] " pinskia at gcc dot gnu.org
2023-06-29 19:13 ` pinskia at gcc dot gnu.org
2023-06-29 19:14 ` [Bug tree-optimization/110487] [12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-06-29 23:10 ` pinskia at gcc dot gnu.org
2023-06-30  7:01 ` rguenth at gcc dot gnu.org
2023-06-30 12:50 ` pinskia at gcc dot gnu.org
2023-07-01  0:48 ` pinskia at gcc dot gnu.org
2023-07-01  0:49 ` pinskia at gcc dot gnu.org
2023-07-01  1:01 ` pinskia at gcc dot gnu.org
2023-07-01  1:03 ` pinskia at gcc dot gnu.org
2023-07-01  2:48 ` pinskia at gcc dot gnu.org
2023-07-01  2:49 ` pinskia at gcc dot gnu.org
2023-07-04 17:20 ` cvs-commit at gcc dot gnu.org
2023-07-04 17:20 ` cvs-commit at gcc dot gnu.org
2023-07-04 17:22 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).