[Bug tree-optimization/126627] New: `(a&-a) < 0` -> `a == INT_MIN`

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]> Tue, 04 Aug 2026 01:01:17 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126627

            Bug ID: 126627
           Summary: `(a&-a) < 0` -> `a =3D=3D INT_MIN`
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: easyhack, missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

For signed comparisons:

`(a&-a) < 0` -> `a =3D=3D INT_MIN`
`(a&-a) >=3D 0` -> `a !=3D INT_MIN`

That is if a is signed or `(a & -a)` is casted to signed integer.=