tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Duplicate double


From: Christian JULLIEN
Subject: Re: [Tinycc-devel] Duplicate double
Date: Sat, 3 Aug 2019 07:24:23 +0200 (CEST)


I tried to compile your sample to give more feedbacks to maintainers:


#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;}


On Linux x86_64, Linux Aarch64, Windows 32 and 64. They all with give the right expected result.


Is it the mod version? How do you compile tcc with MinGW? Looks this bug is more related to MinGW and its libs (or the calling protocol used by them). FYI, the tcc version I use on Windows is tcc compiled by tcc boostrapped by Cygwin gcc. This one works like a charm.




Le : 02 août 2019 à 20:50 (GMT +02:00)
De : "Klaus Ebbe Grue" <address@hidden>
À : "address@hidden" <address@hidden>
Objet : [Tinycc-devel] Duplicate double


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)
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

reply via email to

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