On April 10, 2021 8:11:33 AM GMT+02:00, Jakub Jelinek <ja...@redhat.com> wrote:
>Hi!
>
>This PR is about a -W*uninitialized warning on riscv64. 
>alloca_type_and_limit is documented to have limit member only defined
>when type is ALLOCA_BOUND_MAYBE_LARGE or ALLOCA_BOUND_DEFINITELY_LARGE
>and otherwise just default constructs limit, which for wide_int means
>no initialization at all.  IMHO it is fine not to use the limit
>member otherwise, but trying to not initialize it when it can be e.g.
>copied around and then invoke UB doesn't look like a good idea.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, though I don't
>have
>riscv64 access to verify if it fixes the reported warning.  Ok for
>trunk?

Ok. 

Richard. 
>
>2021-04-10  Jakub Jelinek  <ja...@redhat.com>
>
>       PR middle-end/99989
>       * gimple-ssa-warn-alloca.c
>       (alloca_type_and_limit::alloca_type_and_limit): Initialize limit to
>       0 with integer precision unconditionally.
>
>--- gcc/gimple-ssa-warn-alloca.c.jj    2021-01-04 10:25:38.892233156 +0100
>+++ gcc/gimple-ssa-warn-alloca.c       2021-04-09 12:46:27.466847728 +0200
>@@ -124,9 +124,8 @@ public:
>   alloca_type_and_limit (enum alloca_type type,
>                        wide_int i) : type(type), limit(i) { }
>   alloca_type_and_limit (enum alloca_type type) : type(type)
>-  { if (type == ALLOCA_BOUND_MAYBE_LARGE
>-      || type == ALLOCA_BOUND_DEFINITELY_LARGE)
>-      limit = wi::to_wide (integer_zero_node);
>+  {
>+    limit = wi::to_wide (integer_zero_node);
>   }
> };
> 
>
>       Jakub

Reply via email to