diff options
| -rw-r--r-- | gcc/ChangeLog | 4 | ||||
| -rw-r--r-- | gcc/tree.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ed3086..c9976bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +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> * combine.c (combine_validate_cost): Adjust comments. Set registered @@ -2462,6 +2462,10 @@ array_type_nelts (const_tree type) min = TYPE_MIN_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) ? max : fold_build2 (MINUS_EXPR, TREE_TYPE (max), max, min)); |
