[Bug middle-end/87319] When vector is wrapped, expression is not optimized.

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Sep 15 16:59:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87319

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-09-15
          Component|c                           |middle-end
     Ever confirmed|0                           |1

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
There are 2 places that do this transformation. One in match.pd applies only
when the type has wrapping overflow. The other one in fold_plusminus_mult_expr
applies only if the expression can be seen from the front-end, not if it
appears after inlining and simplifications. The one in fold_plusminus_mult_expr
has code to convert to an unsigned type if necessary to perform this
transformation. This code is buggy (it might cause wrong code generation), it
tests INTEGRAL_TYPE_P instead of ANY_INTEGRAL_TYPE_P (careful that it uses
unsigned_type_for later, which IIRC does not handle complex types) so it gets
the wrong answer for vectors and does the transformation in type VInt (test1).
Such code using an unsigned type is missing in match.pd.


More information about the Gcc-bugs mailing list