On 11/29/2016 12:48 PM, Jakub Jelinek wrote:
Hi!

As mentioned in the PR, the LSHIFT_EXPR computation of values that
will need longest or shortest string is both incorrect (it shifts
integer_one_node left, so for precisions above precision of integer
it returns 0 (not to mention that it is invalid GENERIC, because the types
of first operand and result have to match)) and unnecessary - every integral
type already has TYPE_MIN_VALUE and TYPE_MAX_VALUE readily available.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Note, in the PR I've raised various further questions, Martin, can you look
at them?

2016-11-29  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/78586
        * gimple-ssa-sprintf.c (format_integer): Use TYPE_MAX_VALUE or
        TYPE_MIN_VALUE or build_all_ones_cst instead of folding LSHIFT_EXPR.
        Don't build_int_cst min/max twice.  Formatting fix.

        * gcc.c-torture/execute/pr78586.c: New test.
This is OK. Note there's a goodly amount of code duplicated in that last hunk. Your call whether or not to try and unify any of that.

jeff

Reply via email to