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?
gcc/

	* gimple-ssa-warn-alloca.c
	(alloca_type_and_limit::alloca_type_and_limit): Initialize limit
	field for ALLOCA_BOUND_*_LARGE.

diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c
index 4d5aed866e1..d1b1de4a2d5 100644
--- a/gcc/gimple-ssa-warn-alloca.c
+++ b/gcc/gimple-ssa-warn-alloca.c
@@ -128,7 +128,11 @@ struct alloca_type_and_limit {
   alloca_type_and_limit ();
   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) { }
+  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);
+  }
 };
 
 /* Return the value of the argument N to -Walloca-larger-than= or

Reply via email to