Commit b365495a by Duncan Sands Committed by Duncan Sands

Bail out rather than crashing in array_type_nelts if TYPE_MAX_VALUE is null.

From-SVN: r172227
parent 273a32b8
2011-04-09 Duncan Sands <baldrick@free.fr>
* tree.c (array_type_nelts): Bail out if TYPE_MAX_VALUE not set.
2011-04-08 Eric Botcazou <ebotcazou@adacore.com> 2011-04-08 Eric Botcazou <ebotcazou@adacore.com>
* combine.c (combine_validate_cost): Adjust comments. Set registered * combine.c (combine_validate_cost): Adjust comments. Set registered
......
...@@ -2462,6 +2462,10 @@ array_type_nelts (const_tree type) ...@@ -2462,6 +2462,10 @@ array_type_nelts (const_tree type)
min = TYPE_MIN_VALUE (index_type); min = TYPE_MIN_VALUE (index_type);
max = TYPE_MAX_VALUE (index_type); max = TYPE_MAX_VALUE (index_type);
/* TYPE_MAX_VALUE may not be set if the array has unknown length. */
if (!max)
return error_mark_node;
return (integer_zerop (min) return (integer_zerop (min)
? max ? max
: fold_build2 (MINUS_EXPR, TREE_TYPE (max), max, min)); : fold_build2 (MINUS_EXPR, TREE_TYPE (max), max, min));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment