Hi Avi,
Great! Thanks! https://0x0.st/zOsg.7z worked. Just to test, I made a fresh msys2 install, cloned git://repo.or.cz/tinycc.git and compiled. That also works. For completeness, I have included the steps. The only surprise was that when using .configure --prefix=/usr I had to add --bindir=/usr/bin since otherwise tcc ends up in /usr/tcc.exe Cheers, Klaus --- Remove C:\msys64 if present Go to https://www.msys2.org/ Click msys2-x86_64-20190524.exe Install msys2 using defaults In MSYS2 shell: > pacman -Syu As instructed, kill and restart MSYS2 shell > pacman -Syu > pacman -S gcc git make texinfo > git clone git://repo.or.cz/tinycc.git > cd tinycc > ./configure --prefix=/usr --bindir=/usr/bin > make > make install > cd > tcc -v tcc version 0.9.27 (x86_64 Windows) > mkdir experiment > cd experiment > 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 -o test test.c > ./test f( 0.0, 7.0, 8.0) ________________________________ Fra: Tinycc-devel [tinycc-devel-bounces+grue=di.ku...@nongnu.org] på vegne af avih via Tinycc-devel [tinycc-devel@nongnu.org] Sendt: 3. august 2019 10:31 Til: tinycc-devel@nongnu.org Cc: avih Emne: Re: [Tinycc-devel] Duplicate double You're right, and I can confirm that the win64 version downloaded the same as you exhibits the same issue, and the issue also exists if I build 0.27 for win64 myself (git d348a9a). However, it was apparently fixed shortly after tcc 0.27 was released, at the following commit: commit 8f6fcb709ae7b2379866c292ce478ab95dc75b48 Author: grischka <grischka> Date: Thu May 31 23:51:51 2018 +0200 misc fixes misc fixes including: - tcc.c: fix "tcc -vv" for libtcc1.a on win32/PE - tccelf.c: fix a crash when GOT has no relocs (witn -nostdlib) - tccelf.c: fix stab linkage for zero n_strx - tccgen.c: fix stdcall decoration for array parameters int __stdcall func(char buf[10]) is _func@4 (was _func@12) - tccgen.c: fix static variables with nocode/nodata_wanted see tests2/96_nodata_wanted.c - tccrun.c: align sections using sh_addralign (for reliable function_alignment) - tests2/Makefile sort 100 after 99 - win32/include/sys/stat.h fix _stat and _wstat - x86_64-gen.c: win64/gfunc_call: fix a bug with xmmN register args previously overwrote valid other xmmN registers eventually Not sure which of the fixes did it, but I'd guess it's at x86_64-gen.c . If you want, I've built tcc for win32 and win64 from the latest git version (mob, 9e429db), and uploaded it here: https://0x0.st/zOsg.7z Cheers, Avi On Friday, August 2, 2019, 9:51:22 PM GMT+3, Klaus Ebbe Grue <g...@di.ku.dk> 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 > 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 Tinycc-devel@nongnu.org<mailto:Tinycc-devel@nongnu.org> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel