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: avoid uninitialized use in -Walloca* pass


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


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