Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2003 17:58:49 -0800
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Joe Marcus Clarke <marcus@marcuscom.com>
Cc:        Kris Kennaway <kris@obsecurity.org>, ia64@freebsd.org
Subject:   Re: AbiWord2 broken on ia64
Message-ID:  <20030315015849.GA1781@dhcp01.pn.xcllnt.net>
In-Reply-To: <1047688506.5788.0.camel@shumai.marcuscom.com>
References:  <20030314170854.GF2611@rot13.obsecurity.org> <1047669110.317.54.camel@gyros> <20030314210743.GC777@dhcp01.pn.xcllnt.net> <1047676322.317.77.camel@gyros> <20030314235526.GB1283@dhcp01.pn.xcllnt.net> <1047688506.5788.0.camel@shumai.marcuscom.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

[gnome@FreeBSD.org removed]

On Fri, Mar 14, 2003 at 07:35:07PM -0500, Joe Marcus Clarke wrote:
> On Fri, 2003-03-14 at 18:55, Marcel Moolenaar wrote:
> > On Fri, Mar 14, 2003 at 04:12:02PM -0500, Joe Marcus Clarke wrote:
> > > > 
> > > > JFYI: After working around the libobjc.a problem for lang/gnustep-base
> > > > I hit upon this as well. It is therefore not specific to AbiWord.
> > > > 
> > > > The label in question is a temporary label with (file) global scope
> > > > and thus never appears in object files (modulo bugs). Hence, this is
> > > > a label that's created by the compiler for its own use.
> > > > 
> > > > I haven't looked at it myself yet. Keep me posted if you tracked it
> > > > down before I do. My suggestion would be to play with the compiler
> > > > options to see which one causes it (besides -O).
> > > 
> > > Thanks!  Will do.
> > 
> > Quick update: it is a compiler bug. I think it might be related to
> > the source language. The gnustep-base case is objective-c and I
> > think ABiWord is C++, right? 
> 
> Well, the part that's complaining is C++, yes.

Ok, it may be related. I think the bug can happen for C as well,
but AFAICT the preconditions for the bug seem to be very specific
so it's probably hidden in the normal case.

> > I've so far not seen it for C code.
> > The only way to get rid of it for gnustep-base is by compiling
> > with -O0. I'll try to identify the source construct (if any) that
> > can cause this...
> 
> Great!  Thanks for doing this.

This is what I've found out so far:

The bug is caused by the second run of the if-converter when the
jump table of a switch statement is eliminated while the code to
access it is still there and predicated.
The best way to see if AbiWord2 is the same is by creating a
preprocessed file and strip as much functions from it as is valid.
Then, running the compiler with -da creates a dozen or so dump
files. Look at a label in <sourcefile>.25.rnreg that you don't
have on <sourcefile>.26.ce2.

In my case (from lang/gnustep-base), I extracted the faulty
function in bug.i (attached). The label and jump table that's
being eliminated by the if-converter are:

\begin{snippet from bug.i.25.rnreg}
;; Insn is not within a basic block
(code_label 10926 10925 10927 103 "" "" [2 uses])
 
;; Insn is not within a basic block
(jump_insn 10927 10926 10928 (addr_diff_vec:DI (label_ref:DI 10926)
        [
            (label_ref:DI 10939)
            (label_ref:DI 10939)
			:
		<95 label_refs removed>
			:
            (label_ref:DI 10939)
            (label_ref:DI 10939)
        ]
        (const_int 0 [0x0])
        (const_int 0 [0x0])) -1 (nil)
    (nil))
\end{snippet} 

If your case is roughly the same, I may be able to hack up a quick
and dirty patch...

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net

--bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bug.i"

void *NSReturnAddress(int offset)
{
	switch (offset) {
	case 0:  return __builtin_return_address(0 + 1);
	case 1:  return __builtin_return_address(1 + 1);
	case 2:  return __builtin_return_address(2 + 1);
	case 3:  return __builtin_return_address(3 + 1);
	case 4:  return __builtin_return_address(4 + 1);
	case 5:  return __builtin_return_address(5 + 1);
	case 6:  return __builtin_return_address(6 + 1);
	case 7:  return __builtin_return_address(7 + 1);
	case 8:  return __builtin_return_address(8 + 1);
	case 9:  return __builtin_return_address(9 + 1);
	case 10: return __builtin_return_address(10 + 1);
	case 11: return __builtin_return_address(11 + 1);
	case 12: return __builtin_return_address(12 + 1);
	case 13: return __builtin_return_address(13 + 1);
	case 14: return __builtin_return_address(14 + 1);
	case 15: return __builtin_return_address(15 + 1);
	case 16: return __builtin_return_address(16 + 1);
	case 17: return __builtin_return_address(17 + 1);
	case 18: return __builtin_return_address(18 + 1);
	case 19: return __builtin_return_address(19 + 1);
	case 20: return __builtin_return_address(20 + 1);
	case 21: return __builtin_return_address(21 + 1);
	case 22: return __builtin_return_address(22 + 1);
	case 23: return __builtin_return_address(23 + 1);
	case 24: return __builtin_return_address(24 + 1);
	case 25: return __builtin_return_address(25 + 1);
	case 26: return __builtin_return_address(26 + 1);
	case 27: return __builtin_return_address(27 + 1);
	case 28: return __builtin_return_address(28 + 1);
	case 29: return __builtin_return_address(29 + 1);
	case 30: return __builtin_return_address(30 + 1);
	case 31: return __builtin_return_address(31 + 1);
	case 32: return __builtin_return_address(32 + 1);
	case 33: return __builtin_return_address(33 + 1);
	case 34: return __builtin_return_address(34 + 1);
	case 35: return __builtin_return_address(35 + 1);
	case 36: return __builtin_return_address(36 + 1);
	case 37: return __builtin_return_address(37 + 1);
	case 38: return __builtin_return_address(38 + 1);
	case 39: return __builtin_return_address(39 + 1);
	case 40: return __builtin_return_address(40 + 1);
	case 41: return __builtin_return_address(41 + 1);
	case 42: return __builtin_return_address(42 + 1);
	case 43: return __builtin_return_address(43 + 1);
	case 44: return __builtin_return_address(44 + 1);
	case 45: return __builtin_return_address(45 + 1);
	case 46: return __builtin_return_address(46 + 1);
	case 47: return __builtin_return_address(47 + 1);
	case 48: return __builtin_return_address(48 + 1);
	case 49: return __builtin_return_address(49 + 1);
	case 50: return __builtin_return_address(50 + 1);
	case 51: return __builtin_return_address(51 + 1);
	case 52: return __builtin_return_address(52 + 1);
	case 53: return __builtin_return_address(53 + 1);
	case 54: return __builtin_return_address(54 + 1);
	case 55: return __builtin_return_address(55 + 1);
	case 56: return __builtin_return_address(56 + 1);
	case 57: return __builtin_return_address(57 + 1);
	case 58: return __builtin_return_address(58 + 1);
	case 59: return __builtin_return_address(59 + 1);
	case 60: return __builtin_return_address(60 + 1);
	case 61: return __builtin_return_address(61 + 1);
	case 62: return __builtin_return_address(62 + 1);
	case 63: return __builtin_return_address(63 + 1);
	case 64: return __builtin_return_address(64 + 1);
	case 65: return __builtin_return_address(65 + 1);
	case 66: return __builtin_return_address(66 + 1);
	case 67: return __builtin_return_address(67 + 1);
	case 68: return __builtin_return_address(68 + 1);
	case 69: return __builtin_return_address(69 + 1);
	case 70: return __builtin_return_address(70 + 1);
	case 71: return __builtin_return_address(71 + 1);
	case 72: return __builtin_return_address(72 + 1);
	case 73: return __builtin_return_address(73 + 1);
	case 74: return __builtin_return_address(74 + 1);
	case 75: return __builtin_return_address(75 + 1);
	case 76: return __builtin_return_address(76 + 1);
	case 77: return __builtin_return_address(77 + 1);
	case 78: return __builtin_return_address(78 + 1);
	case 79: return __builtin_return_address(79 + 1);
	case 80: return __builtin_return_address(80 + 1);
	case 81: return __builtin_return_address(81 + 1);
	case 82: return __builtin_return_address(82 + 1);
	case 83: return __builtin_return_address(83 + 1);
	case 84: return __builtin_return_address(84 + 1);
	case 85: return __builtin_return_address(85 + 1);
	case 86: return __builtin_return_address(86 + 1);
	case 87: return __builtin_return_address(87 + 1);
	case 88: return __builtin_return_address(88 + 1);
	case 89: return __builtin_return_address(89 + 1);
	case 90: return __builtin_return_address(90 + 1);
	case 91: return __builtin_return_address(91 + 1);
	case 92: return __builtin_return_address(92 + 1);
	case 93: return __builtin_return_address(93 + 1);
	case 94: return __builtin_return_address(94 + 1);
	case 95: return __builtin_return_address(95 + 1);
	case 96: return __builtin_return_address(96 + 1);
	case 97: return __builtin_return_address(97 + 1);
	case 98: return __builtin_return_address(98 + 1);
	case 99: return __builtin_return_address(99 + 1);
	}
	return 0;
}

--bg08WKrSYDhXBjb5--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ia64" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030315015849.GA1781>