This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix ICE with -Wuninitialized (PR tree-optimization/78455)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]