gimple-ssa-warn-alloca: Always initialize limit [PR99989]
authorJakub Jelinek <jakub@redhat.com>
Sat, 10 Apr 2021 10:48:04 +0000 (12:48 +0200)
committerJakub Jelinek <jakub@redhat.com>
Sat, 10 Apr 2021 10:48:04 +0000 (12:48 +0200)
commit3e350d8539a4e28ddc30d0f08a4040f10b699135
tree6bc8db2262ec1f8239bb7b0ffeae87590efee9e0
parent7a493fcd27d6a1af896c4f5ef4ab1e0afe8a839d
gimple-ssa-warn-alloca: Always initialize limit [PR99989]

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.

2021-04-10  Jakub Jelinek  <jakub@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