From 9db73acb488d610af4f4b3f637ca7187830b874c Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 27 Jul 1993 16:42:34 -0400 Subject: [PATCH] (optimize_bit_field_compare): Preserve volatility of bitfield. From-SVN: r5005 --- gcc/fold-const.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5f23e98ff95..a88b6197efc 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, -- 2.30.2