Another Unaligned Access/Code Generation Question

Jay Estabrook Jay.Estabrook at hp.com
Thu May 22 19:06:32 UTC 2008


Hi again,

In the current Fedora 8 Alpha distro, KDE is getting, I think, a LOT
more use than ever before, due to the GNOME problems. Because of that,
UAs in KDE apps are, or have become, the majority of UAs showing up
in /var/log/messages.

I've tracked down a single point of unaligned access in one of the
kdebase libraries that is continually showing up, as it is called by
MANY of the KDE applications, like kicker and konsole and such.

It is located in code whose name, according to GDB, is:

_ZNK14QLocalePrivate14doubleToStringEdiNS_10DoubleFormEij

And yes, that is almost certainly in C++ code... ;-}

The UA is always from an instruction like:

     ldt     $f10,-5721(t0)

where register "t0" holds an aligned address in the "gp" area, and thus
the odd offset is what causes the UA.

I tried both GCC -23 and -37, and there was no difference in code.

I tried using "-mbuild-constants", and, while it changed some of the
surrounding code, did not prevent the same (different but still
odd offset) instruction from getting generated.

I'm wondering what kind of C/C++ code could cause such to be generated?
(I know, I know, not much to go on; I could get additional logs.)

I thought it might be register spill code that had run out of INT regs
and went to FP ones, which was why I tried the "mbuild-constants" thing,
but that probably wasn't a good guess, seeing as the name of the routine
IS "doubleToString"... ;-}

Now, granted, this is not a high traffic UA, only occurs a few times
per app, apparently, but it is VERY annoying, since it manifests as MANY
different applications appearing to be the culprit of UAs.

In addition, it apparently is not BAD code - that is, there doesn't
appear to be anything wrong with the results of its "fix up", meaning
the data is probably OK too, and found where pointed at.

I wonder if there's anything I can do about it?

Thanks again for any insights.

--Jay++






More information about the axp-list mailing list