diff options
author | Duncan Sands <baldrick@free.fr> | 2011-04-09 18:18:01 +0200 |
---|---|---|
committer | Duncan Sands <baldrick@gcc.gnu.org> | 2011-04-09 16:18:01 +0000 |
commit | b365495ab5fbdf842db5b909b88dea4e2d778a87 (patch) | |
tree | 9b22aaa17b2834fb5b3ad816a37fbc488ab116e4 /gcc/tree.c | |
parent | 273a32b891873d3be99d115eba8624c1a8c9d0a6 (diff) | |
download | gcc-b365495ab5fbdf842db5b909b88dea4e2d778a87.zip gcc-b365495ab5fbdf842db5b909b88dea4e2d778a87.tar.gz gcc-b365495ab5fbdf842db5b909b88dea4e2d778a87.tar.bz2 |
Bail out rather than crashing in array_type_nelts if TYPE_MAX_VALUE is null.
From-SVN: r172227
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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)); |