]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Nov 2012 22:49:41 +0000 (22:49 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Nov 2012 22:49:41 +0000 (22:49 +0000)
* 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

gcc/ChangeLog
gcc/stor-layout.c

index 59982dfb1e6758d3dda291fffac758147476305b..8990122d3ab331a81fd596cb7eebc5027d8d6e9c 100644 (file)
@@ -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
index 03da59e0f1f62e7df4a4d9c309156f60ecc02160..b1b7cb29fc4f0fdd4449fc3a313ed47e9720ef14 100644 (file)
@@ -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.  */