tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] *** SPAM *** Re: Duplicate double


From: Christian JULLIEN
Subject: Re: [Tinycc-devel] *** SPAM *** Re: Duplicate double
Date: Sun, 4 Aug 2019 13:32:27 +0200 (CEST)

Hello Klaus,

I don't know how Avi builds tcc on Windows but, on my side, I have made this companion repository that works well with Cygwin:

https://sourceforge.net/projects/wintcc/

Basically, get the cygwin/Makefile you have to drop in tcc/win32, and just run "make" (files in includes are already integrated in tcc and you don't need them)
It builds a native tcc 32/64 compiler built with tcc bootstrapped with gcc (i.e. a reproductible build).
A Makefile named "tarball" produces a standalone .zip you can use on any Windows machine.
tcc compiled binary does not need cygwin runtime to be present.

I don't understand quite well why Grischka refused to add it on official tcc distrib.

C.


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


Hi again Avi,

 

Can I persuade you to tell how you built https://0x0.st/zOsg.7z ?

 

In particular, how you made the lib and includes relative to the location of 'tcc.exe' for tcc32 and tcc64.

 

Googling around seems to suggest that one should use the right host (MinGW? Cygwin?) and use the right ./configure options.

 

Cheers,
Klaus

 

 


Fra: Tinycc-devel [tinycc-devel-bounces+grue=address@hidden] på vegne af Klaus Ebbe Grue [address@hidden]
Sendt: 3. august 2019 16:14
Til: address@hidden
Emne: Re: [Tinycc-devel] Duplicate double

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=address@hidden] på vegne af avih via Tinycc-devel [address@hidden]
Sendt: 3. august 2019 10:31
Til: address@hidden
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 <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



_______________________________________________
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]