This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: avoid uninitialized use in -Walloca* pass
- From: Jeff Law <law at redhat dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew MacLeod <amacleod at redhat dot com>
- Date: Tue, 11 Sep 2018 16:50:54 -0600
- Subject: Re: avoid uninitialized use in -Walloca* pass
- References: <c3bbd856-e65a-c028-dbb7-74b40837d631@redhat.com>
On 9/7/18 3:12 AM, Aldy Hernandez wrote:
> Semi obvious patch here...
>
> As the comment for alloca_type_and_limit says:
>
> // For ALLOCA_BOUND_MAYBE_LARGE and ALLOCA_BOUND_DEFINITELY_LARGE
> // types, this field indicates the assumed limit if known or
> // integer_zero_node if unknown. For any other alloca types, this
> // field is undefined.
>
> So, there's no sense in creating ALLOCA_BOUND_*_LARGE entries without a
> limit, as doing so would trigger reading undefined memory later on.
>
> We could put an assert here, but I'd rather just let the constructor
> build the right thing.
>
> OK for trunk?
>
> curr.patch
>
> gcc/
>
> * gimple-ssa-warn-alloca.c
> (alloca_type_and_limit::alloca_type_and_limit): Initialize limit
> field for ALLOCA_BOUND_*_LARGE.
OK.
jeff