[PATCH 3/3] [PPC64LE/Generic] fpcmp change to handle backing up past beginning of string.

Will Schmidt will_schmidt at vnet.ibm.com
Tue Mar 11 12:53:27 PDT 2014


During the make test steps, the fpcmp utility tends to hang when run in
the PPC64 LE environment.  Per some debug, the utility is finding non-null
values during BackupNumber() when it backs up past the beginning of the
string during the isNumberChar(Pos[-1]) check, which is confusing the logic.
It is not clear to me why this issue is not seen elsewhere.  This patch
is sufficient to correct the problem locally.
---
 projects/test-suite/tools/fpcmp.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/projects/test-suite/tools/fpcmp.c b/projects/test-suite/tools/fpcmp.c
index c86e7d0..b430b2e 100644
--- a/projects/test-suite/tools/fpcmp.c
+++ b/projects/test-suite/tools/fpcmp.c
@@ -48,6 +48,8 @@ static bool isNumberChar(char C) {
 }
 
 static const char *BackupNumber(const char *Pos, const char *FirstChar) {
+  // If we're already at the beginning of the string, just return.
+  if (Pos == FirstChar) return Pos;
   // If we didn't stop in the middle of a number, don't backup.
   if (!isNumberChar(*Pos) && !isNumberChar(Pos[-1])) return Pos;
   // If we're one past the number, the two numbers can have different number




More information about the llvm-commits mailing list