https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90774
--- Comment #3 from Shawn Landden <slandden at gmail dot com> --- > So this kind of reassociation can only be done with either -fwrapv or > unsigned types. Due to integer overflow being undefined. That depends on 1) if operations are re-ordered differn't to the order of operations, and 2) how the other optimizations handle integer overflow that they determine is UB -fwrapv is completely legal even if it is not passed, and generally I think this optimization (if applicable) would outweigh some UB optimizations.