public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix bitfield reduction during expansion
@ 2011-06-15 12:09 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2011-06-15 12:09 UTC (permalink / raw)
  To: gcc-patches


We handle integer types with bitfield precision but not other
integral types which the middle-end considers equivalent.  Noticed
while working on bitfield reference lowering where this causes
some miscompiles with boolean bitfields.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2011-06-15  Richard Guenther  <rguenther@suse.de>

	* expr.c (expand_expr_real_2): Reduce all integral types to
	bitfield precision.
	(expand_expr_real_1): Likewise.

Index: gcc/expr.c
===================================================================
--- gcc/expr.c	(revision 175011)
+++ gcc/expr.c	(working copy)
@@ -7264,7 +7264,7 @@ expand_expr_real_2 (sepops ops, rtx targ
   /* An operation in what may be a bit-field type needs the
      result to be reduced to the precision of the bit-field type,
      which is narrower than that of the type's mode.  */
-  reduce_bit_field = (TREE_CODE (type) == INTEGER_TYPE
+  reduce_bit_field = (INTEGRAL_TYPE_P (type)
 		      && GET_MODE_PRECISION (mode) > TYPE_PRECISION (type));
 
   if (reduce_bit_field && modifier == EXPAND_STACK_PARM)
@@ -8333,7 +8333,7 @@ expand_expr_real_1 (tree exp, rtx target
      result to be reduced to the precision of the bit-field type,
      which is narrower than that of the type's mode.  */
   reduce_bit_field = (!ignore
-		      && TREE_CODE (type) == INTEGER_TYPE
+		      && INTEGRAL_TYPE_P (type)
 		      && GET_MODE_PRECISION (mode) > TYPE_PRECISION (type));
 
   /* If we are going to ignore this result, we need only do something

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-15 11:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-15 12:09 [PATCH] Fix bitfield reduction during expansion Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).