https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112581
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Adding -fdisable-tree-reassoc2 causes the problem not to happen so yes it is a bug in reassoc. If I get some time next week I will look into adding the support.