[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Bug Report (0.9.27+, Win64): Incorrect code generated for
From: |
Max Petulante |
Subject: |
[Tinycc-devel] Bug Report (0.9.27+, Win64): Incorrect code generated for floating point conversion and operation inside function call |
Date: |
Wed, 21 Feb 2018 14:00:39 -0500 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tinycc-devel] Bug Report (0.9.27+, Win64): Incorrect code generated for floating point conversion and operation inside function call,
Max Petulante <=