This is the mail archive of the 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]

Re: RFA: Patch for new demangler

On Sat, Nov 22, 2003 at 10:14:14AM -0500, Ian Lance Taylor wrote:
> I'm not sure that it is possible to demangle floating point literals
> correctly unless you assume that the demangler is running on the same
> system as the compiler which generated the mangled name.  That might
> be an OK assumption, but since I come from a cross-compilation world,
> I didn't want to make it.  My demangler produces
>     void f<1>(A<(1) + (((int)(-((float)3f800000))))>)
> I don't know what is best for this type of case, admittedly an unusual
> one.

Yeah :/.  This is why all mangled names should use the same format imho.
I consider it a bug in the ABI that not all mangled names follow the
IEEE standard; after all, they DO correct the endianness (mangled names
always follow big endian) - seems inconsistent to make symbols incompatible
in other cases.  You can determine the size of the float or double from
the mangled name (in ABI version 2).  So, this problem would not exist
if all mangled names used big endian IEEE formats for their floating point
value mangling.  My demangler will assume IEEE only - because it would be
guessing to heuristically determine if it is not, and for example is a
Cray format instead.

CC to

> As noted in an earlier message, I believe it is the former.

Thanks, I'll fix it.

> > ~/c++/demangler>./c++filt _Z1fILi1EEv1AIXplT_cvingLf3f800000EEE 2> /dev/null
> > void f<1>(A<(1) + ((int)(-((float)7.8125e-3)))>)
> This is an interesting case, because the correct demangling would be
> something like
>     void f<1>(A<(1) + ((int)(-((float)1.0)))>)

Heh - well, I didn't test float yet, only double :p.
I just fixed this.

Carlo Wood <>

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