This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ping] Re: [PATCH] dump_case_nodes: Treat unsigned as unsigned, don't ICE
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 24 May 2014 09:25:18 -0500
- Subject: [ping] Re: [PATCH] dump_case_nodes: Treat unsigned as unsigned, don't ICE
- Authentication-results: sourceware.org; auth=none
- References: <dee35fc1b743c339e0562b674324d7d4d9c7a33a dot 1400608417 dot git dot segher at kernel dot crashing dot org>
Ping?
On Tue, May 20, 2014 at 10:58:27AM -0700, Segher Boessenkool wrote:
> The current code converts every tree to signed hwi; this ICEs with
> values not representable as shwi, like 9999999999999999999ULL in
> pr34154.c (and if it didn't ICE, it would print the wrong value).
>
> This fixes it. Bootstrapped and tested on powerpc64-linux. Okay
> to apply?
>
>
> Segher
>
>
> 2014-05-20 Segher Boessenkool <segher@kernel.crashing.org>
>
> gcc/
> * stmt.c (dump_case_nodes): Don't convert values to HOST_WIDE_INT
> before printing.
>
> ---
> gcc/stmt.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/gcc/stmt.c b/gcc/stmt.c
> index 163d495..722d34f 100644
> --- a/gcc/stmt.c
> +++ b/gcc/stmt.c
> @@ -774,24 +774,20 @@ static void
> dump_case_nodes (FILE *f, struct case_node *root,
> int indent_step, int indent_level)
> {
> - HOST_WIDE_INT low, high;
> -
> if (root == 0)
> return;
> indent_level++;
>
> dump_case_nodes (f, root->left, indent_step, indent_level);
>
> - low = tree_to_shwi (root->low);
> - high = tree_to_shwi (root->high);
> -
> fputs (";; ", f);
> - if (high == low)
> - fprintf (f, "%*s" HOST_WIDE_INT_PRINT_DEC,
> - indent_step * indent_level, "", low);
> - else
> - fprintf (f, "%*s" HOST_WIDE_INT_PRINT_DEC " ... " HOST_WIDE_INT_PRINT_DEC,
> - indent_step * indent_level, "", low, high);
> + fprintf (f, "%*s", indent_step * indent_level, "");
> + print_dec (root->low, f, TYPE_SIGN (TREE_TYPE (root->low)));
> + if (!tree_int_cst_equal (root->low, root->high))
> + {
> + fprintf (f, " ... ");
> + print_dec (root->high, f, TYPE_SIGN (TREE_TYPE (root->high)));
> + }
> fputs ("\n", f);
>
> dump_case_nodes (f, root->right, indent_step, indent_level);
> --
> 1.8.1.4