aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2018-04-16 11:22:40 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2018-04-16 11:22:40 +0000
commit402140beccd93b6a568eac76bc15b5d2f551e5f4 (patch)
tree3a4e46438b46f5e88a516a6dc46faeb407517198 /libgcc
parent334419e16410853bf2119e639f252cac439fa6b7 (diff)
PR target/84945
* config/i386/cpuinfo.c (set_feature): Wrap into do while (0) to avoid -Wdangling-else warnings. Mask shift counts to avoid -Wshift-count-negative and -Wshift-count-overflow false positives. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259398 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog7
-rw-r--r--libgcc/config/i386/cpuinfo.c9
2 files changed, 15 insertions, 1 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index a715f0b074e..aeaa6539167 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-04-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84945
+ * config/i386/cpuinfo.c (set_feature): Wrap into do while (0) to avoid
+ -Wdangling-else warnings. Mask shift counts to avoid
+ -Wshift-count-negative and -Wshift-count-overflow false positives.
+
2018-04-06 Ruslan Bukin <br@bsdpad.com>
* config.host (riscv*-*-freebsd*): Add RISC-V FreeBSD support.
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index 1dac110a79a..86953db2743 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -275,7 +275,14 @@ get_available_features (unsigned int ecx, unsigned int edx,
}
#define set_feature(f) \
- if (f < 32) features |= (1U << f); else features2 |= (1U << (f - 32))
+ do \
+ { \
+ if (f < 32) \
+ features |= (1U << (f & 31)); \
+ else \
+ features2 |= (1U << ((f - 32) & 31)); \
+ } \
+ while (0)
if (edx & bit_CMOV)
set_feature (FEATURE_CMOV);