Hello, procps fails its tests on core-updates when built with --system=i686-linux (it succeeds on x86_64).
The error is completely not understandable (and Debian has disabled the test). I modified the test file as attached; my changes are to compute the value val separately before the "if" (interestingly enough, the variable declaration "double val;" was already there), and I added the fprintf at the beginnings of the lines. The test then fails and prints CMP 1 CMP 0 DIF 0.000000 FAIL: strtod_nol_or_err("123") != 123.000000 So val != tests[i].result when the "if" is executed, this is still the case for the first fprintf, and then changes for the second fprintf. Has anyone got any explanation for this behaviour? A compiler error? Here: https://www.freelists.org/post/procps/strtod-nol-or-err-on-32bit-Was-procps-3312-released,2 the conclusion is "Ive got a pending patch to just remove it. Floating point math sucks when it comes to equality." but this is not even floating point maths - whatever the contents of val and tests[i].result, they should not be changed by a comparison (or an fprintf; I can also make the test work just by adding some printf into the strtod_nol_or_err function that is exercised by this test). Andreas
#include <stdio.h> #include <stdlib.h> #include "strutils.h" struct strtod_tests { char *string; double result; }; struct strtod_tests tests[] = { {"123", 123.0}, {"-123", -123.0}, {"12.34", 12.34}, {"-12.34", -12.34}, {".34", 0.34}, {"-.34", -0.34}, {"12,34", 12.34}, {"-12,34", -12.34}, {",34", 0.34}, {"-,34", -0.34}, {"0", 0.0}, {".0", 0.0}, {"0.0", 0.0}, {NULL, 0.0} }; int main(int argc, char *argv[]) { int i; double val; for(i=0; tests[i].string != NULL; i++) { val = strtod_nol_or_err(tests[i].string, "Cannot parse number"); if (val != tests[i].result) { fprintf(stderr, "CMP %i\n", val != tests[i].result); fprintf(stderr, "CMP %i\n", val != tests[i].result); fprintf(stderr, "DIF %f\n", val - tests[i].result); fprintf(stderr, "FAIL: strtod_nol_or_err(\"%s\") != %f\n", tests[i].string, tests[i].result); return EXIT_FAILURE; } //fprintf(stderr, "PASS: strtod_nol for %s\n", tests[i].string); } return EXIT_SUCCESS; }