[Bug tree-optimization/115864] New: right shift being optimised out incorrectly

2024-07-10 Thread notzed at gmail dot com via Gcc-bugs
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

[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread notzed at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864

--- Comment #1 from Michael Zutti  ---
Created attachment 58629
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58629&action=edit
preprocessed file

[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread notzed at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864

--- Comment #2 from Michael Zutti  ---
Created attachment 58630
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58630&action=edit
output of gcc -v

[Bug tree-optimization/115864] right shift being optimised out incorrectly

2024-07-10 Thread notzed at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864

--- Comment #4 from Michael Zucchi  ---
ok thought it might be something like that.  is there any way to prevent it?