Skip site navigation (1)Skip section navigation (2)
Date:      15 Mar 2003 15:14:13 -0500
From:      Joe Marcus Clarke <marcus@marcuscom.com>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        Kris Kennaway <kris@obsecurity.org>, ia64@freebsd.org
Subject:   Re: AbiWord2 broken on ia64
Message-ID:  <1047759253.81982.30.camel@shumai.marcuscom.com>
In-Reply-To: <20030315015849.GA1781@dhcp01.pn.xcllnt.net>
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> <20030315015849.GA1781@dhcp01.pn.xcllnt.net>

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

--=-/jrPR9URzHHkcaQoTMZI
Content-Type: multipart/mixed; boundary="=-3jnNvEVzf80vj2RDXcDD"


--=-3jnNvEVzf80vj2RDXcDD
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Fri, 2003-03-14 at 20:58, Marcel Moolenaar wrote:
> [gnome@FreeBSD.org removed]
>=20
> 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:
> > > > >=20
> > > > > 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.
> > > > >=20
> > > > > The label in question is a temporary label with (file) global sco=
pe
> > > > > and thus never appears in object files (modulo bugs). Hence, this=
 is
> > > > > a label that's created by the compiler for its own use.
> > > > >=20
> > > > > 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 compile=
r
> > > > > options to see which one causes it (besides -O).
> > > >=20
> > > > Thanks!  Will do.
> > >=20
> > > 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?=20
> >=20
> > Well, the part that's complaining is C++, yes.
>=20
> 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.
>=20
> > > 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...
> >=20
> > Great!  Thanks for doing this.
>=20
> This is what I've found out so far:
>=20
> 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.
>=20
> 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:
>=20
> \begin{snippet from bug.i.25.rnreg}
> ;; Insn is not within a basic block
> (code_label 10926 10925 10927 103 "" "" [2 uses])
> =20
> ;; 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}=20
>=20
> If your case is roughly the same, I may be able to hack up a quick
> and dirty patch...

It appears my situation is similar.  I have attached the offending
function as well as the missing code_label and jump_insn.  Hope this
helps.

Joe

--=20
PGP Key : http://www.marcuscom.com/pgp.asc

--=-3jnNvEVzf80vj2RDXcDD
Content-Disposition: attachment; filename=abiword.bad
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=abiword.bad; charset=ISO-8859-1

--Begin code_label--
;; Insn is not within a basic block
(code_label 423 422 424 32 "" "" [2 uses])
--End code_label--

--Begin jump_insn--
;; Insn is not within a basic block
(jump_insn 424 423 425 (addr_diff_vec:DI (label_ref:DI 423)
        [
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
            (label_ref:DI 398)
        ]
        (const_int 0 [0x0])
        (const_int 0 [0x0])) -1 (nil)
    (nil))
--End jump_insn--

--Begin function C++ code--
bool pt_PieceTable::deleteSpan(PT_DocPosition dpos1,
							   PT_DocPosition dpos2,
							   PP_AttrProp *p_AttrProp_Before,
							   UT_uint32 &iRealDeleteCount,
							   bool bDeleteTableStruxes,
							   bool bDontGlob)
{
	if(m_pDocument->isMarkRevisions())
	{
		iRealDeleteCount =3D 0;

		const XML_Char name[] =3D "revision";
		const XML_Char * pRevision =3D NULL;

		// first retrive the starting and ending fragments
		pf_Frag * pf1, * pf2;
		PT_BlockOffset Offset1, Offset2;

		if(!getFragsFromPositions(dpos1,dpos2, &pf1, &Offset1, &pf2, &Offset2))
			return false;

		// now we have to traverse the fragments and change their
		// formatting

		pf_Frag * pTemp;
		pf_Frag * pEnd =3D pf2->getNext();
		pf_Frag * pNext;


		for(pTemp =3D pf1; pTemp !=3D pEnd; pTemp =3D pNext)
		{
			// we cannot ask for the next in the for statement,
			// because we might have deleted that fragment by then
			pNext =3D pTemp->getNext();

			// get attributes for this fragement
			const PP_AttrProp * pAP;
			pf_Frag::PFType eType =3D pTemp->getType();
			UT_uint32 iLen;
			PTStruxType eStruxType;

			if(eType =3D=3D pf_Frag::PFT_Text)
			{
				if(!getAttrProp(((pf_Frag_Text*)pTemp)->getIndexAP(),&pAP))
					return false;
			}
			else if(eType =3D=3D pf_Frag::PFT_Strux)
			{
				if(!getAttrProp(((pf_Frag_Strux*)pTemp)->getIndexAP(),&pAP))
					return false;

				eStruxType =3D ((pf_Frag_Strux*)pTemp)->getStruxType();

				switch (eStruxType)
				{
					case PTX_Block:
						iLen =3D pf_FRAG_STRUX_BLOCK_LENGTH;
						break;

					case PTX_Section:
					case PTX_SectionHdrFtr:
					case PTX_SectionEndnote:
					case PTX_SectionTable:
					case PTX_SectionCell:
					case PTX_SectionFootnote:
					case PTX_EndCell:
					case PTX_EndTable:
				    case PTX_EndFootnote:
						iLen =3D pf_FRAG_STRUX_SECTION_LENGTH;
						break;

					default:
						UT_ASSERT(UT_NOT_IMPLEMENTED);
						iLen =3D 1;
						break;
				}

			}
			else if(eType =3D=3D pf_Frag::PFT_Object)
			{
				if(!getAttrProp(((pf_Frag_Object*)pTemp)->getIndexAP(),&pAP))
					return false;
			}
			else
			{
				// something that does not carry AP
				continue;
			}

			if(!pAP->getAttribute(name, pRevision))
				pRevision =3D NULL;

			PP_RevisionAttr Revisions(pRevision);

			// now we need to see if revision with this id is already
			// present, and if it is, whether it might not be addition
			UT_uint32 iId =3D m_pDocument->getRevisionId();
			const PP_Revision * pRev =3D Revisions.getGreatestLesserOrEqualRevision(=
iId);

			PT_DocPosition dposEnd =3D UT_MIN(dpos2,dpos1 + pTemp->getLength());

			if(pRev && iId =3D=3D pRev->getId())
			{
				// OK, we already have a revision with this id here,
				// which means that the editor made a change earlier
				// (insertion or format change) but now wants this deleted
				//
				// so if the previous revision is an addition, we just
				// remove this fragment as if this was regular delete
				if(   (pRev->getType() =3D=3D PP_REVISION_ADDITION)
				   || (pRev->getType() =3D=3D PP_REVISION_ADDITION_AND_FMT ))
				{
					if(!_realDeleteSpan(dpos1, dposEnd, p_AttrProp_Before,bDeleteTableStru=
xes,
										bDontGlob))
						return false;

					iRealDeleteCount +=3D dposEnd - dpos1;

					dpos1 =3D dposEnd;
					continue;
				}
			}

			Revisions.addRevision(iId,PP_REVISION_DELETION,NULL,NULL);
			const XML_Char * ppRevAttrib[3];
			ppRevAttrib[0] =3D name;
			ppRevAttrib[1] =3D Revisions.getXMLstring();
			ppRevAttrib[2] =3D NULL;

			switch (eType)
			{
				case pf_Frag::PFT_Text:
					if(! _realChangeSpanFmt(PTC_AddFmt, dpos1, dposEnd, ppRevAttrib,NULL))
						return false;
					break;

				case pf_Frag::PFT_Strux:
					if(! _realChangeStruxFmt(PTC_AddFmt, dpos1 + iLen, dpos1 + 2*iLen, ppR=
evAttrib,NULL,eStruxType))
						return false;
					break;
#if 0
				case pf_Frag::PFT_Object:
					if(! _realChangeStruxFmt(PTC_AddFmt, dpos1, dposEnd, ppRevAttrib,NULL)=
)
						return false;
					break;
#endif
				default:;
			}

			dpos1 =3D dposEnd;
		}

		return true;
	}
	else
		return _realDeleteSpan(dpos1, dpos2, p_AttrProp_Before, bDeleteTableStrux=
es,
							   bDontGlob);
}
--End function C++ code--

--=-3jnNvEVzf80vj2RDXcDD--

--=-/jrPR9URzHHkcaQoTMZI
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQA+c4mUb2iPiv4Uz4cRAtLRAKCRnfqG2CdVAyxseeMSZLVnYjdZZgCfflW2
DFemKUndyS3pMal7IbCeN6E=
=jzlM
-----END PGP SIGNATURE-----

--=-/jrPR9URzHHkcaQoTMZI--


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?1047759253.81982.30.camel>