diff options
author | Richard Guenther <rguenther@suse.de> | 2006-06-19 14:48:47 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-06-19 14:48:47 +0000 |
commit | 096dce1b1bf69529a83de92dc17018c82b7b22ec (patch) | |
tree | 94e0d422465e6c5021873e4eb47e883ac058f5fd /gcc/fold-const.c | |
parent | 46b86adcdc8bdf4f49df1b52de41eefd9a1afd60 (diff) | |
download | gcc-096dce1b1bf69529a83de92dc17018c82b7b22ec.zip gcc-096dce1b1bf69529a83de92dc17018c82b7b22ec.tar.gz gcc-096dce1b1bf69529a83de92dc17018c82b7b22ec.tar.bz2 |
re PR middle-end/28045 (Bitfield, &&, and optimization => bad code generation)
2006-06-19 Richard Guenther <rguenther@suse.de>
PR middle-end/28045
* fold-const.c (operand_equal_p): Check if the argument types
have the same precision before stripping NOPs.
* gcc.dg/torture/pr28045.c: New testcase.
From-SVN: r114772
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 57a7248..5a65586 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2497,6 +2497,11 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags) if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1))) return 0; + /* If both types don't have the same precision, then it is not safe + to strip NOPs. */ + if (TYPE_PRECISION (TREE_TYPE (arg0)) != TYPE_PRECISION (TREE_TYPE (arg1))) + return 0; + STRIP_NOPS (arg0); STRIP_NOPS (arg1); |