diff options
author | Richard Guenther <rguenther@suse.de> | 2012-01-03 08:59:21 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-01-03 08:59:21 +0000 |
commit | 8b3c295192e3886940be529ebd380b093d77fdef (patch) | |
tree | cce39e915f0c8795b8736c761af35b64f69fe9a8 /gcc/fold-const.c | |
parent | 96fda42cb42f8aa502b306f2626227d5d2615919 (diff) | |
download | gcc-8b3c295192e3886940be529ebd380b093d77fdef.zip gcc-8b3c295192e3886940be529ebd380b093d77fdef.tar.gz gcc-8b3c295192e3886940be529ebd380b093d77fdef.tar.bz2 |
re PR c/51730 (autoconf 2.60 through 2.67 stdbool.h check fails with GCC 4.7)
2012-01-03 Richard Guenther <rguenther@suse.de>
PR middle-end/51730
* fold-const.c (fold_comparison): Properly canonicalize
tree offset and HOST_WIDE_INT bit position.
* gcc.dg/fold-compare-6.c: New testcase.
From-SVN: r182830
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5d3196b..b88b5d7 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8886,6 +8886,14 @@ fold_comparison (location_t loc, enum tree_code code, tree type, indirect_base0 = true; } offset0 = TREE_OPERAND (arg0, 1); + if (host_integerp (offset0, 0) + && ((HOST_WIDE_INT) (TREE_INT_CST_LOW (offset0) * BITS_PER_UNIT) + / BITS_PER_UNIT + == (HOST_WIDE_INT) TREE_INT_CST_LOW (offset0))) + { + bitpos0 = TREE_INT_CST_LOW (offset0) * BITS_PER_UNIT; + offset0 = NULL_TREE; + } } base1 = arg1; @@ -8909,6 +8917,14 @@ fold_comparison (location_t loc, enum tree_code code, tree type, indirect_base1 = true; } offset1 = TREE_OPERAND (arg1, 1); + if (host_integerp (offset1, 0) + && ((HOST_WIDE_INT) (TREE_INT_CST_LOW (offset1) * BITS_PER_UNIT) + / BITS_PER_UNIT + == (HOST_WIDE_INT) TREE_INT_CST_LOW (offset1))) + { + bitpos1 = TREE_INT_CST_LOW (offset1) * BITS_PER_UNIT; + offset1 = NULL_TREE; + } } /* A local variable can never be pointed to by |