This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[vta] fix two thinkos in expand_debug_expr()


EXPAND_INITIALIZER implies EXPAND_CONST_ADDR, and it's not a bitmask.
I'm still a bit amazed that this actually worked for a while ;-)

In a conversion, taking the mode from the expansion of the operand,
rather than from what we might expect at first, guarantees that we
will perform a conversion if one is needed.  Without this, we failed
bootstrap-debug assertions on i686-pc-linux-gnu.

Installing in the vta branch.

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* cfgexpand.c (expand_debug_expr): Use just
	EXPAND_INITIALIZERf for constants.  Get inner_mode for
	conversions from the operand.

Index: gcc/cfgexpand.c
===================================================================
--- gcc/cfgexpand.c.orig	2007-11-23 18:05:54.000000000 -0200
+++ gcc/cfgexpand.c	2007-11-25 01:45:05.000000000 -0200
@@ -1631,8 +1631,7 @@ expand_debug_expr (tree exp)
     case FIXED_CST:
     case COMPLEX_CST:
     case STRING_CST:
-      op0 = expand_expr (exp, NULL_RTX, mode,
-			 EXPAND_INITIALIZER | EXPAND_CONST_ADDRESS);
+      op0 = expand_expr (exp, NULL_RTX, mode, EXPAND_INITIALIZER);
       if (op0 && GET_MODE (op0) == VOIDmode && mode != VOIDmode)
 	return op0 = gen_rtx_CONST (mode, op0);
       return op0;
@@ -1640,12 +1639,14 @@ expand_debug_expr (tree exp)
     case NOP_EXPR:
     case CONVERT_EXPR:
       {
-	enum machine_mode inner_mode
-	  = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
+	enum machine_mode inner_mode = GET_MODE (op0);
 
-	if (mode == GET_MODE (op0))
+	if (mode == inner_mode)
 	  return op0;
 
+	if (inner_mode == VOIDmode)
+	  inner_mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
+
 	if (CONSTANT_P (op0)
 	    || GET_MODE_BITSIZE (mode) <= GET_MODE_BITSIZE (GET_MODE (op0)))
 	  op0 = simplify_gen_subreg (mode, op0, inner_mode,
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]