Reviewed-by: Jaben Carsey <[email protected]>

From: Mcdaniel, Daryl
Sent: Tuesday, August 05, 2014 5:55 PM
To: [email protected]
Subject: [PATCH] Fix StdLib floating point format regression

Jaben, Erik, or Lee: could you please review this?
Could someone else validate this on Linux and/or ARM?
                Thanks.

StdLib: The formatting for double float values, within the gdtoa library, is 
improper.

When running Enquire.efi, several errors similar to the following are produced:
Maximum exponent = 128
Maximum number = 3.40282347e+38

*** WARNING: Possibly bad output from printf above
    expected value around 3.40282347e38, bit pattern:
    11111111 11111111 01111111 01111111
    sscanf gave           -inf, bit pattern:
    00000000 00000000 10000000 11111111
    difference= inf

Overflow doesn't seem to generate a trap

The memory allocation tests will also fail, sometimes leaving all available 
memory consumed.

The correct output in the above example is:
Maximum exponent = 128
Maximum number = 3.40282347e+38
Overflow doesn't seem to generate a trap

The root cause is that all operations on values of Long or ULong type, within 
the gdtoa library, must be 32-bit operations.  A previous change replaced the 
Long and ULong definitions with INTN and UINTN, respectively.  While this is 
correct for a lot of Linux and NetBSD code, it was not correct for this library.

This fix reverts the definitions of ULong and Long back to 32-bit types.
A descriptive comment has also been added to the U union.
Additional white-space has been added to tidy up the definitions of the word0 
and word1 macros.

Verified with Enquire.efi and the ISO/IEC C Library compliance Validation Suite.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daryl McDaniel 
<[email protected]<mailto:[email protected]>>


Daryl McDaniel

"Patriotism is supporting your country all the time, and your government when 
it deserves it."
-- Mark Twain

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to