Skip to content

Commit a301eb1

Browse files
committed
fpcmp: Allow decimal numbers ending with a period
After 8a84a50, fpcmp requires at least one post-decimal digit when period present. This leads to incorrect comparison results for 628.pop2_s of SPEC2017 because this program outputs `65.` when the Fortran compiler is flang while the reference output is `65.0`.
1 parent 460eedc commit a301eb1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

tools/fpcmp.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,13 @@ static const char *AdvanceNumber(const char *StartPos, const char *End) {
6767
// Decimal separator
6868
if (Pos < End && *Pos == '.') {
6969
++Pos;
70+
EndOfNumber = Pos;
7071

71-
// Post-decimal digits (require at least one when period present)
72-
bool HasPostDecimalDigit = false;
72+
// Post-decimal digits (optional)
7373
while (Pos < End && isDigitChar(*Pos)) {
74-
HasPostDecimalDigit = true;
75-
7674
++Pos;
7775
EndOfNumber = Pos;
7876
}
79-
if (!HasPostDecimalDigit)
80-
return EndOfNumber;
8177
}
8278

8379
// Require a valid number before the exponent.

0 commit comments

Comments
 (0)