1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

fpcmp: Fix a possible infinite loop when comparing something like:

1..19 ok
to
  1..20 o k
(yes, the odd space is necessary).

llvm-svn: 106032
This commit is contained in:
Daniel Dunbar 2010-06-15 19:20:28 +00:00
parent 48961d3ca6
commit 1412c49c07

View File

@ -51,7 +51,15 @@ static const char *BackupNumber(const char *Pos, const char *FirstChar) {
if (!isNumberChar(*Pos)) return Pos;
// Otherwise, return to the start of the number.
bool HasPeriod = false;
while (Pos > FirstChar && isNumberChar(Pos[-1])) {
// Backup over at most one period.
if (Pos[-1] == '.') {
if (HasPeriod)
break;
HasPeriod = true;
}
--Pos;
if (Pos > FirstChar && isSignedChar(Pos[0]) && !isExponentChar(Pos[-1]))
break;