diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-20 22:49:41 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-20 22:49:41 +0000 |
commit | efa6660d4b6a8cf6b9337631ae31ef2ef747f02e (patch) | |
tree | dd09e9dfa2f4585203ec1bc13e1074783b5e38f4 /gcc/stor-layout.c | |
parent | a04eda631cd2de47aac07433a9292fba8b45ffef (diff) | |
download | gcc-efa6660d4b6a8cf6b9337631ae31ef2ef747f02e.tar.gz |
gcc/
* stor-layout.c (bit_field_mode_iterator::next_mode): Fix signedness.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193680 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 03da59e0f1f..b1b7cb29fc4 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -2670,10 +2670,6 @@ bit_field_mode_iterator::next_mode (enum machine_mode *out_mode) if (unit != GET_MODE_PRECISION (mode_)) continue; - /* Skip modes that are too small. */ - if ((bitpos_ % unit) + bitsize_ > unit) - continue; - /* Stop if the mode is too wide to handle efficiently. */ if (unit > MAX_FIXED_MODE_SIZE) break; @@ -2683,11 +2679,18 @@ bit_field_mode_iterator::next_mode (enum machine_mode *out_mode) if (count_ > 0 && unit > BITS_PER_WORD) break; + /* Skip modes that are too small. */ + unsigned HOST_WIDE_INT substart = (unsigned HOST_WIDE_INT) bitpos_ % unit; + unsigned HOST_WIDE_INT subend = substart + bitsize_; + if (subend > unit) + continue; + /* Stop if the mode goes outside the bitregion. */ - HOST_WIDE_INT start = bitpos_ - (bitpos_ % unit); + HOST_WIDE_INT start = bitpos_ - substart; if (bitregion_start_ && start < bitregion_start_) break; - if (start + unit > bitregion_end_ + 1) + HOST_WIDE_INT end = start + unit; + if (end > bitregion_end_ + 1) break; /* Stop if the mode requires too much alignment. */ |