https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114047
Bug ID: 114047 Summary: `(cast)(cast)a != a` for large unsigned _BitInt should be produce better code Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` unsigned foo (unsigned _BitInt(512) ub512_0) { unsigned _BitInt(255) t; return __builtin_sub_overflow (ub512_0, 0, &t); } unsigned foo1 (unsigned _BitInt(512) ub512_0) { unsigned _BitInt(255) t = ub512_0; return t != ub512_0; } ``` Currently foo produces decent code but foo1 does not even though they are equivalent. Noticed while looking into PR 114040.