tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Duplicate double


From: Klaus Ebbe Grue
Subject: [Tinycc-devel] Duplicate double
Date: Fri, 2 Aug 2019 18:49:41 +0000

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
> wget http://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27-win64-bin.zip
> 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]