diff options
author | 2003-08-06 13:53:18 +0000 | |
---|---|---|
committer | 2003-08-06 13:53:18 +0000 | |
commit | 38c3d01865c652d4c2a62624f4b011a15e311ab1 (patch) | |
tree | a1ad9f803619e24928031b673f812b67a413d98c | |
parent | typo; (diff) | |
download | wireguard-openbsd-38c3d01865c652d4c2a62624f4b011a15e311ab1.tar.xz wireguard-openbsd-38c3d01865c652d4c2a62624f4b011a15e311ab1.zip |
Check for and skip variable-length arrays while bounds checking instead
of erroring out in a later sanity check. Error noticed by jolan@
This only affects the -Wbounded case
-rw-r--r-- | gnu/egcs/gcc/c-common.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gnu/egcs/gcc/c-common.c b/gnu/egcs/gcc/c-common.c index beffb8497cb..95942113ff0 100644 --- a/gnu/egcs/gcc/c-common.c +++ b/gnu/egcs/gcc/c-common.c @@ -2025,9 +2025,14 @@ check_bound_info (info, params) int array_size, length, elem_size, type_size; tree array_size_expr = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (buf_expr))); tree array_type = TREE_TYPE (TREE_TYPE (buf_expr)); + tree array_type_size_expr = TYPE_SIZE (array_type); + + /* Can't deal with variable-sized arrays yet */ + if (TREE_CODE (array_type_size_expr) != INTEGER_CST) + return; /* Get the size of the type of the array and sanity check it */ - type_size = TREE_INT_CST_LOW (TYPE_SIZE (array_type)); + type_size = TREE_INT_CST_LOW (array_type_size_expr); if ((type_size % 8) != 0) { error ("found non-byte aligned type while checking bounds"); |