1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

AsmParser: Don't crash on short hex constants for fp128 types

If we see 0xL01, treat it like 0xL00000000000000000000000000000001
instead of crashing.

llvm-svn: 223811
This commit is contained in:
David Majnemer 2014-12-09 19:10:03 +00:00
parent 517aa95182
commit e1b75899bd
2 changed files with 11 additions and 5 deletions

View File

@ -78,13 +78,15 @@ uint64_t LLLexer::HexIntToVal(const char *Buffer, const char *End) {
void LLLexer::HexToIntPair(const char *Buffer, const char *End,
uint64_t Pair[2]) {
Pair[0] = 0;
for (int i=0; i<16; i++, Buffer++) {
if (End - Buffer >= 16) {
for (int i = 0; i < 16; i++, Buffer++) {
assert(Buffer != End);
Pair[0] *= 16;
Pair[0] += hexDigitValue(*Buffer);
}
}
Pair[1] = 0;
for (int i=0; i<16 && Buffer != End; i++, Buffer++) {
for (int i = 0; i < 16 && Buffer != End; i++, Buffer++) {
Pair[1] *= 16;
Pair[1] += hexDigitValue(*Buffer);
}

View File

@ -0,0 +1,4 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
@x = global fp128 0xL01
; CHECK: @x = global fp128 0xL00000000000000000000000000000001