diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2012-11-20 22:49:41 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2012-11-20 22:49:41 +0000 |
commit | ec593a8fc3c739005538ffbe097a6ad38240be6d (patch) | |
tree | dd09e9dfa2f4585203ec1bc13e1074783b5e38f4 | |
parent | 341e19df23701a75f32dd31c24575c85abe961c7 (diff) | |
download | gcc-ec593a8fc3c739005538ffbe097a6ad38240be6d.zip gcc-ec593a8fc3c739005538ffbe097a6ad38240be6d.tar.gz gcc-ec593a8fc3c739005538ffbe097a6ad38240be6d.tar.bz2 |
stor-layout.c (bit_field_mode_iterator::next_mode): Fix signedness.
gcc/
* stor-layout.c (bit_field_mode_iterator::next_mode): Fix signedness.
From-SVN: r193680
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/stor-layout.c | 15 |
2 files changed, 13 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 59982df..8990122 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2012-11-20 Richard Sandiford <rdsandiford@googlemail.com> + + * stor-layout.c (bit_field_mode_iterator::next_mode): Fix signedness. + 2012-11-20 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/55396 diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 03da59e..b1b7cb2 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. */ |