Buggy assertion in APFloat::convertFromHexadecimalString

Hello.

When running clang in Debug mode, I am getting an assertion failure when parsing the following line:

float ko = 0x1.1p0;

Apparently, the recent changes in the use of StringRef haven't been propagated to all places. Please find attached the trivial patch.

Cheers,
Enea Zaffanella.

APFloat.patch (343 Bytes)

Can you please also add a test to unittests/ADT/APFloatTest.cpp to validate this, i.e., a test that would fail before this patch but passes with this patch.

Fixed in r79450, along with an additional one of the same nature.

Thanks,
- Daniel

Thanks Daniel and Enea for finding this! I'm adding a lot more test
cases like this to APFloat's unittests so hopefully we won't have any
other bugs lying around.

Thanks Daniel and Enea for finding this! I'm adding a lot more test
cases like this to APFloat's unittests so hopefully we won't have any
other bugs lying around.

I just committed a big batch of unit tests for APFloat, As best as I
can tell, we're in compliance with C99's floating point standard,
ignoring the suffix:

floating-constant:

decimal-floating-constant
hexadecimal-floating-constant

decimal-floating-constant:

fractional-constant exponent-part? floating-suffix?
digit-sequence exponent-part floating-suffix?

hexadecimal-floating-constant:

hexadecimal-prefix hexadecimal-fractional-constant

binary-exponent-part floating-suffix?

hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part

floating-suffix?

fractional-constant:

digit-sequence? .digit-sequence
digit-sequence .

exponent-part:

e sign? digit-sequence
E sign? digit-sequence

sign:

+
-

digit-sequence:

digit
digit-sequence digit

hexadecimal-fractional-constant:

hexadecimal-digit-sequence? . hexadecimal-digit-sequence
hexadecimal-digit-sequence .

binary-exponent-part:

p sign? digit-sequence
P sign? digit-sequence

hexadecimal-digit-sequence:

hexadecimal-digit
hexadecimal-digit-sequence hexadecimal-digit

floating-suffix: one of