http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52976
--- Comment #3 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-04-13 19:41:18 UTC --- When changing from the original form of the patch to the form that recorded repeated ops in the ops table, I missed the effect on undistribution where a term contains a multiply of a repeated op. Those terms should be excluded from undistribution to return to the former behavior, and I'll work on fixing that for the short term. However, it would eventually be better to factor a P out of the example in this case: c1 + 2.*P*c2 + 3.*P**2*c3 ==> c1 + P * (2.*c2 + 3.*P*c3) In the original form of the patch, this was handled naturally because P**2 was expanded into P*P and the existing logic was sufficient. I just missed the need to add some logic to undistribution.