https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864
Bug ID: 115864
Summary: right shift being optimised out incorrectly
Product: gcc
Version: 14.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: notzed at gmail dot com
Target Milestone: ---
Created attachment 58628
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58628&action=edit
minimal example
I have some code that performs some calculations then checks the high bit using
a shift or sign test. In both cases the test is being optimised away despite
the high bit being set.
Using -fdump-tree-all it looks like it's removed at the step
'test.c.042t.evrp'.
Compiling with -Og or -O0 gives the expected result, any others do not. Also
tested with gcc 13.2.1.
Output of test.c with -Os (or higher), amd64 systems.
m = fffe0001
m >> 30 0003
m >> 31
m < 0 ? 0