aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-07-27 16:42:34 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1993-07-27 16:42:34 -0400
commit9db73acb488d610af4f4b3f637ca7187830b874c (patch)
treeb32a5420dde7da444fa808d1b6f8680af087780a /gcc
parent19fdd3eecb6ae79bd9b1af26d287462351b6e020 (diff)
downloadgcc-9db73acb488d610af4f4b3f637ca7187830b874c.zip
gcc-9db73acb488d610af4f4b3f637ca7187830b874c.tar.gz
gcc-9db73acb488d610af4f4b3f637ca7187830b874c.tar.bz2
(optimize_bit_field_compare): Preserve volatility of bitfield.
From-SVN: r5005
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 5f23e98..a88b619 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2421,6 +2421,11 @@ optimize_bit_field_compare (code, compare_type, lhs, rhs)
appropriate number of bits and mask it with the computed mask
(in case this was a signed field). If we changed it, make a new one. */
lhs = make_bit_field_ref (linner, unsigned_type, lnbitsize, lnbitpos, 1);
+ if (lvolatilep)
+ {
+ TREE_SIDE_EFFECTS (lhs) = 1;
+ TREE_THIS_VOLATILE (lhs) = 1;
+ }
rhs = fold (const_binop (BIT_AND_EXPR,
const_binop (LSHIFT_EXPR,