[cxx-abi-dev] Clarification about mangling floating point literals

Mike Herrick mjh at edg.com
Tue Jun 11 12:31:01 UTC 2013


This point appears to have come up multiple times over the years, with this post being the earliest I could find:

http://communities.mentor.com/community/cs/archives/cxx-abi-dev/msg01527.html

We proposed striking the "without leading zeros" wording in this post, but those changes were never integrated into the document:

http://communities.mentor.com/community/cs/archives/cxx-abi-dev/msg02291.html

Since then, the issue of mangling a floating-point zero was also brought up by Jason in a post titled "Mangling 0.0f" dated January 18, 2012 (the mailing list archives don't appear to cover newer posts):

> I notice that G++ and EDG mangle 0.0f as Lf00000000E, while clang produces Lf0E.  I assume that the latter is based on the "without leading zeroes" in the ABI document, while the former is based on the "fixed-length" earlier in the sentence.


It seems the document should be updated to prevent future confusion.

Mike Herrick
Edison Design Group

On Jun 11, 2013, at 2:18 AM, Matthew Dempsky <matthew at dempsky.org> wrote:

> On Mon, Jun 10, 2013 at 10:40 PM, Dennis Handly <dhandly at cup.hp.com> wrote:
>>> From: Matthew Dempsky <matthew at dempsky.org>
>>> Can someone please clarify for me how floating-point literals can be
>>> encoded as a "fixed-length" string but "without leading zeros"?  E.g.,
>>> how should 0.0f be encoded?
>> 
>> I would assume you remove all but the only zero nibble.
>> I.e. The last zero isn't leading.
> 
> For what it's worth, GCC 4.6.3 and Clang 3.2 when targeting
> x86_64-linux-gnu both mangle 0.0f as Lf00000000E.
> 
> (But Clang 3.2 mangles 0.0l as Le3fff8000000000000000E, whereas GCC
> 4.6.3 mangles it as Le0000000000003fff8000000000000000E.  I don't have
> newer versions readily available to check.)
> _______________________________________________
> cxx-abi-dev mailing list
> cxx-abi-dev at codesourcery.com
> http://sourcerytools.com/cgi-bin/mailman/listinfo/cxx-abi-dev



More information about the cxx-abi-dev mailing list