This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix ICE with -Wuninitialized (PR tree-optimization/78455)
- From: Christophe Lyon <christophe dot lyon at linaro dot org>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Aldy Hernandez <aldyh at redhat dot com>
- Date: Wed, 23 Nov 2016 14:40:24 +0100
- Subject: Re: [PATCH] Fix ICE with -Wuninitialized (PR tree-optimization/78455)
- Authentication-results: sourceware.org; auth=none
- References: <20161122000240.GW3646@redhat.com>
Hi Marek,
On 22 November 2016 at 01:02, Marek Polacek <polacek@redhat.com> wrote:
> What seems like a typo caused an ICE here. We've got a vector of vectors here
> and we're trying to walk all the elements, so the second loop oughta use 'j'.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2016-11-21 Marek Polacek <polacek@redhat.com>
>
> PR tree-optimization/78455
> * tree-ssa-uninit.c (can_chain_union_be_invalidated_p): Fix typo.
>
> * gcc.dg/uninit-23.c: New.
>
> diff --git gcc/testsuite/gcc.dg/uninit-23.c gcc/testsuite/gcc.dg/uninit-23.c
> index e69de29..b38e1d0 100644
> --- gcc/testsuite/gcc.dg/uninit-23.c
> +++ gcc/testsuite/gcc.dg/uninit-23.c
> @@ -0,0 +1,27 @@
> +/* PR tree-optimization/78455 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -Wuninitialized" } */
> +
> +int ij;
> +
> +void
> +ql (void)
> +{
> + int m5 = 0;
> +
> + for (;;)
> + {
> + if (0)
> + for (;;)
> + {
> + int *go;
> + int *t4 = go;
> +
> + l1:
> + *t4 = (*t4 != 0) ? 0 : 2; /* { dg-warning "may be used uninitialized" } */
> + }
> +
> + if (ij != 0)
> + goto l1;
> + }
> +}
> diff --git gcc/tree-ssa-uninit.c gcc/tree-ssa-uninit.c
> index 68dcf15..4557403 100644
> --- gcc/tree-ssa-uninit.c
> +++ gcc/tree-ssa-uninit.c
> @@ -2192,7 +2192,7 @@ can_chain_union_be_invalidated_p (pred_chain_union use_preds,
> pred_chain c = use_preds[i];
> bool entire_pred_chain_invalidated = false;
> for (size_t j = 0; j < c.length (); ++j)
> - if (can_one_predicate_be_invalidated_p (c[i], worklist))
> + if (can_one_predicate_be_invalidated_p (c[j], worklist))
> {
> entire_pred_chain_invalidated = true;
> break;
>
> Marek
Since you committed this patch (r242733), I've noticed a regression:
gcc.dg/uninit-pred-6_c.c warning (test for warnings, line 43)
now fails on some arm targets, for instance arm-none-linux-gnueabihf
--with-cpu=cortex-a5 --with-fpu=vfpv3-d16-fp16
(or similarly on arm-none-eabi --with-cpu=cortex-m3 --with-mode=thumb)
Configurations with cortex-a9/a15/a57 are OK.
gcc.dg/uninit-pred-7_c.c now passes on cortex-a5 (no longer ICE)
Christophe