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,vta4.3] handle negative bitpos expanding debug stmts


crtstuff computes __CTOR_END__ - 1, and this ICEd while testing
-fcompare-debug.  It's normally compiled with -g0, but I introduced
-gtoggle for -fcompare-debug, so it ended up compiled for comparison
with -g2, and the assignment p = __CTOR_END__ - 1; generated a debug
stmt with the expression &__CTOR_END__[-1], which exposed the failure
of expand_debug_expr() to handle negative bitpos.  Fixed as follows.

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

	* cfgexpand.c (expand_debug_expr): Handle negative bitpos.

Index: gcc/cfgexpand.c
===================================================================
--- gcc/cfgexpand.c.orig	2008-09-05 03:09:56.000000000 -0300
+++ gcc/cfgexpand.c	2008-09-05 03:11:24.000000000 -0300
@@ -2176,6 +2176,12 @@ expand_debug_expr (tree exp)
 		op0 = adjust_address_nv (op0, mode1, bitpos / BITS_PER_UNIT);
 		bitpos %= BITS_PER_UNIT;
 	      }
+	    else if (bitpos < 0)
+	      {
+		int units = (-bitpos + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
+		op0 = adjust_address_nv (op0, mode1, units);
+		bitpos += units * BITS_PER_UNIT;
+	      }
 	    else if (bitpos == 0 && bitsize == GET_MODE_BITSIZE (mode))
 	      op0 = adjust_address_nv (op0, mode, 0);
 	    else if (GET_MODE (op0) != mode1)
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}
FSFLA Board Member       ÂSÃ Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}

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