Hello everyone,

I've stumbled upon a bug. Consider this simple program:

#include <stdio.h>

void
foo (float f1, float f2)
{
    printf ("foo received args: %f, %f\n", f1, f2);
}

int
main ()
{
    int x = 1;
    foo (0.0f + x, 2.0f);
    return 0;
}

The bug is that the values received by foo are incorrect; it prints "foo
received args: 2.000000, 2.000000" instead of "1.000, 2.000". I've done
some experimenting and found:
  1. The bug does not seem to affect Linux (specifically I tested on
OpenSUSE 42.3 x64).
  2. The bug does not appear if you change the type of x to float, remove
the addition by zero, compute the first argument in an intermediate
variable, or remove the second argument.
  3. It does still appear if you change the floating point types to double.
  4. It appears on both version 0.9.27 and the very latest version.

Hope this helps,
Max
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to