[llvm-commits] [llvm] r51132 - /llvm/trunk/lib/Support/APFloat.cpp

Neil Booth neil at daikokuya.co.uk
Wed May 14 15:22:36 PDT 2008


Dale Johannesen wrote:-

> Author: johannes
> Date: Wed May 14 17:05:31 2008
> New Revision: 51132
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=51132&view=rev
> Log:
> Remove undefined behavior in hex string->APFloat
> conversion.  Try 0x1.0000a4p+0f.  Neil, please review.
> 
> 
> Modified:
>     llvm/trunk/lib/Support/APFloat.cpp
> 
> Modified: llvm/trunk/lib/Support/APFloat.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=51132&r1=51131&r2=51132&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/Support/APFloat.cpp (original)
> +++ llvm/trunk/lib/Support/APFloat.cpp Wed May 14 17:05:31 2008
> @@ -2003,7 +2003,7 @@
>    firstSignificantDigit = p;
>  
>    for(;;) {
> -    unsigned int hex_value;
> +    uint64_t hex_value;
>  
>      if(*p == '.') {
>        assert(dot == 0);

Looks good (the left shift being the problem, right?).

The line you're changing was created by the following, sadly mostly
obfuscating, patch; not sure what it really achieved:

http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?r1=49983&r2=50590&diff_format=h

Obfuscation == introduction of bugs.  The bug was not there originally.

Neil.



More information about the llvm-commits mailing list