Hi, we encountered an issue when manipulating doubles in the last version (0.9.27) of tcc. It looks like the stack is not correctly managed for that type.
The joined test file compute the same values in two different ways. The results should be the same, but they're different. On GNU/Linux, it works perfectly (I only tested 64 bits) On Windows 10 (64 bits): 32bits: If I compile using -m32, it works. 64bits: if I don't specify or use -m64 it failed. I also did the test by using float instead of double and it works. So the problem only occurs for double on 64 bits Windows. Cordialement/Regards. -- Clément Franchini
#include <math.h> #include <stdio.h> typedef double float_t; static float_t mfoo(float_t x) { (void) x; return 2.0; } static float_t mbar(float_t pressure, float_t temperature) { (void) temperature; (void) pressure; return 293.0; } int main(void) { float_t k1; float_t k2; float_t aa; float_t bb; k1 = 15.0 * mfoo(15.0); k2 = mbar(105.0, 293.0); aa = k1 * k2; bb = (15.0 * mfoo(15.0)) * mbar(105.0, 293.0); printf(">>>>> bb=%g aa=%g\n", bb, aa); printf(">>>>> err - =%g\n", aa - bb); printf(">>>>> err / =%g\n", bb / aa); fflush(stdout); return 0; }
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel