summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-05-14 10:26:56 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-05-14 10:26:56 +0000
commita9afe22d0ef7ce4b9df4171bb1ea5d680c1d868e (patch)
tree16b607967d4aebcb98e1ed5bfb6c62b0fab2b0ea /gnu
parent81d6ce9ad97774ac96b484f20be78a8f886a461c (diff)
Fix ICE when checking a zero-size array for __bounded__ (TYPE_MAX_VALUE
is now NULL for zero-length arrays so check for that). ok avsm
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gcc/gcc/c-bounded.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gnu/usr.bin/gcc/gcc/c-bounded.c b/gnu/usr.bin/gcc/gcc/c-bounded.c
index 81d12e54ff3..fcfaeba889e 100644
--- a/gnu/usr.bin/gcc/gcc/c-bounded.c
+++ b/gnu/usr.bin/gcc/gcc/c-bounded.c
@@ -439,14 +439,17 @@ check_bounded_info (status, info, params)
type_size /= 8;
/* Both the size of the static buffer and the length should be
- * integer constants by now */
- if (TREE_CODE (array_size_expr) != INTEGER_CST
+ * integer constants by now, unless the array size is 0 */
+ if ((array_size_expr && TREE_CODE (array_size_expr) != INTEGER_CST)
|| TREE_CODE (length_expr) != INTEGER_CST
|| TREE_CODE (size_expr) != INTEGER_CST)
return;
/* array_size_expr contains maximum array index, so add one for size */
- array_size = (TREE_INT_CST_LOW (array_size_expr) + 1) * type_size;
+ if (array_size_expr)
+ array_size = (TREE_INT_CST_LOW (array_size_expr) + 1) * type_size;
+ else
+ array_size = 0;
length = TREE_INT_CST_LOW (length_expr);
/* XXX - warn about a too-small buffer? */