aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/evaluate.c
diff options
authorChristopher Li <sparse@chrisli.org>2014-07-15 23:20:09 -0700
committerChristopher Li <sparse@chrisli.org>2014-07-17 08:58:28 -0700
commit09e7a493cf3d92a6ccd7611b69bd41cb5727f765 (patch)
treea8e8f1e972bb06bbea3ee5d44ddb6ae38d99fb1f /evaluate.c
parentb3e9d87c6a98bde0c95bc8badfde75c06661738b (diff)
downloadsparse-dev-09e7a493cf3d92a6ccd7611b69bd41cb5727f765.tar.gz
round up the array element size to byte align
When layout the array element, the element size should round up to byte align. Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'evaluate.c')
-rw-r--r--evaluate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/evaluate.c b/evaluate.c
index 7ce8c555..03992d03 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -2302,7 +2302,7 @@ static struct expression *check_designators(struct expression *e,
}
type = ctype->ctype.base_type;
if (ctype->bit_size >= 0 && type->bit_size >= 0) {
- unsigned offset = e->idx_to * type->bit_size;
+ unsigned offset = array_element_offset(type->bit_size, e->idx_to);
if (offset >= ctype->bit_size) {
err = "index out of bounds in";
break;