On Friday, August 2, 2019, 9:51:22 PM GMT+3, Klaus Ebbe Grue <address@hidden> wrote:
Hi tinycc-devel,
Under MSYS2/MinGW I have a problem with tcc.
I define this functions:
void f(double x,double y,double z){printf("f(%4.1f,%4.1f,%4.1f)\n",x,y,z);}
As an example, f(1,2,3) prints f( 1.0, 2.0, 3.0).
Then I call f from main in a slightly confusing way:
int main(int argc,char **argv){double u=0.0;f(u*1.0,7.0,8.0);return 0;}
I would expect to get f( 0.0, 7.0, 8.0) but I do get f( 7.0, 7.0, 8.0).
The first argument of f becomes a duplicate of the second argument of f.
If I remove "*1.0" then everything works as expected.
Is this a known bug?
By the way, if I make the same program using integers, then there is no problem.
I have included a reproduction scenario below.
Cheers,
Klaus
---
Install MSYS2/MinGW
Start MSYS2 shell
> mkdir experiment
> cd experiment
> pacman -S unzip
> unzip tcc-0.9.27-win64-bin.zip
> tcc/tcc -v
tcc version 0.9.27 (x86_64 Windows)
> cat>test.c
#include <stdio.h>
void f(double x,double y,double z){printf("f(%4.1f,%4.1f,%4.1f)\n",x,y,z);}
int main(int argc,char **argv){double u=0.0;f(u*1.0,7.0,8.0);return 0;}
> tcc/tcc -o test test.c
> ./test
f( 7.0, 7.0, 8.0)
_______________________________________________
Tinycc-devel mailing list