llvm.org GIT mirror llvm / ff2c64c
Fix the really bizarre stuff that happened last night in the tester due to non-numeric diff failures that caused fpcmp to go into infinite loops git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14098 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 15 years ago
1 changed file(s) with 14 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
5353 }
5454
5555 static char *BackupNumber(char *Pos, char *FirstChar) {
56 // If we didn't stop in the middle of a number, don't backup.
57 if (!isNumberChar(*Pos)) return Pos;
58
59 // Otherwise, return to the start of the number.
5660 while (Pos > FirstChar && isNumberChar(Pos[-1]))
5761 --Pos;
5862 return Pos;
6064
6165 static void CompareNumbers(char *&F1P, char *&F2P, char *F1End, char *F2End) {
6266 char *F1NumEnd, *F2NumEnd;
63 double V1 = strtod(F1P, &F1NumEnd);
64 double V2 = strtod(F2P, &F2NumEnd);
67 double V1, V2;
68 // If we stop on numbers, compare their difference.
69 if (isNumberChar(*F1P) && isNumberChar(*F2P)) {
70 V1 = strtod(F1P, &F1NumEnd);
71 V2 = strtod(F2P, &F2NumEnd);
72 } else {
73 // Otherwise, the diff failed.
74 F1NumEnd = F1P;
75 F2NumEnd = F2P;
76 }
6577
6678 if (F1NumEnd == F1P || F2NumEnd == F2P) {
6779 std::cerr << "Comparison failed, not a numeric difference.\n";