https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95810
Bug ID: 95810 Summary: Spurious UBSan warning when computing the opposite of the absolute value of INT_MIN Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: felix.von.s at posteo dot de Target Milestone: --- When the expression (x <= 0 ? x : -x) with x having type int is compiled with -fsanitize=undefined -O3, setting (x = INT_MIN) triggers a spurious UBSan warning about INT_MIN being negated. Not sure if I should file this against tree-ssa or the frontend(s), because the expression apparently becomes (-ABS_EXPR <x>) very early, even at -O0. I checked this with C, C++ and D frontends.