public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111913] New: GCC: 14: -O1 compile __builtin_popcount fails while -O0 succeeds
@ 2023-10-22  2:09 141242068 at smail dot nju.edu.cn
  2023-10-22  2:41 ` [Bug tree-optimization/111913] [14 Regression] ICE with __builtin_popcount(X) + __builtin_popcount(Y) simplification pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-10-22  2:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111913
           Summary: GCC: 14: -O1 compile __builtin_popcount fails while
                    -O0 succeeds
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

When compile this program with `-O1`, gcc crashes:
```
int f(unsigned int x, unsigned int y)
{
  return __builtin_popcount (x&y) + __builtin_popcount (y|x--);
}
```

If change the optimization level to `-O0`, then nothing happens.

Compiler Explorer: https://gcc.godbolt.org/z/naoebKMor

The stack dump:
```
<source>: In function 'f':
<source>:4:1: error: invalid conversion in gimple call
    4 | }
      | ^
unsigned int

int

_3 = __builtin_popcount (x_6(D));
<source>:4:1: error: invalid conversion in gimple call
unsigned int

int

_11 = __builtin_popcount (y_7(D));
<source>:4:1: error: type mismatch in binary expression
int

unsigned int

unsigned int

_9 = _3 + _11;
during GIMPLE pass: forwprop
<source>:4:1: internal compiler error: verify_gimple failed
0x231f49e internal_error(char const*, ...)
        ???:0
0x1164659 verify_gimple_in_cfg(function*, bool, bool)
        ???:0
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.
```

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

end of thread, other threads:[~2023-10-24 11:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-22  2:09 [Bug c/111913] New: GCC: 14: -O1 compile __builtin_popcount fails while -O0 succeeds 141242068 at smail dot nju.edu.cn
2023-10-22  2:41 ` [Bug tree-optimization/111913] [14 Regression] ICE with __builtin_popcount(X) + __builtin_popcount(Y) simplification pinskia at gcc dot gnu.org
2023-10-23  9:16 ` rguenth at gcc dot gnu.org
2023-10-23 18:58 ` pinskia at gcc dot gnu.org
2023-10-23 19:40 ` pinskia at gcc dot gnu.org
2023-10-23 19:41 ` pinskia at gcc dot gnu.org
2023-10-23 19:43 ` pinskia at gcc dot gnu.org
2023-10-23 23:05 ` pinskia at gcc dot gnu.org
2023-10-24 11:16 ` cvs-commit at gcc dot gnu.org
2023-10-24 11:17 ` 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).