public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [vta,vta4.3] handle negative bitpos expanding debug stmts
@ 2008-09-10  8:55 Alexandre Oliva
  0 siblings, 0 replies; only message in thread
From: Alexandre Oliva @ 2008-09-10  8:55 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vta-expand-debug-negative-offset.patch --]
[-- Type: text/x-patch, Size: 838 bytes --]

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)

[-- Attachment #3: Type: text/plain, Size: 257 bytes --]


-- 
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}

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

only message in thread, other threads:[~2008-09-10  8:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-10  8:55 [vta,vta4.3] handle negative bitpos expanding debug stmts Alexandre Oliva

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).