[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] i386 build of gawk with tcc now broken
From: |
Thomas Preud'homme |
Subject: |
Re: [Tinycc-devel] i386 build of gawk with tcc now broken |
Date: |
Mon, 09 Sep 2013 23:59:33 +0200 |
User-agent: |
KMail/4.10.5 (Linux/3.10-2-amd64; KDE/4.10.5; x86_64; ; ) |
Le dimanche 8 septembre 2013 17:13:51 Ramsay Jones a écrit :
> On 08/09/13 08:00, address@hidden wrote:
> >>> After pulling the latest on the mob branch, builds of gawk master using
> >>> tcc generate lots of test failures.
> >>>
> >>> On an i386 linux system:
> >>> git clone git://git.savannah.gnu.org/gawk.git
> >>> cd gawk
> >>> ./bootstrap.sh && configure CC=tcc && make
> >>> make check # watch lots of things go kablooey
> >>>
> >>> This does not occur on x86-64.
> >>
> >> Does this also happen with tcc 0.9.26 and tcc 0.9.25 or just with the mob
> >> branch?
> >
> > I'm pretty sure just the mob branch. I can double check tomorrow
> > when I'm at the machine. Almost all the errors are related to floating
> > point exceptions; I strongly suspect it has to do with the most recent
> > changes.
> >
> > The recipe above will let you reproduce it a lot quicker than waiting
> > for me...
> >
> > 0.9.25 won't be worth checking as it's tool old, FWIW.
>
> I have a patch to fix the tests, which fail for me with a Floating
> point exception:
>
> address@hidden $ make test
>
> [snip]
>
> ------------ test3 ------------
> ../tcc -B.. -I.. -I.. -I../include
> -DCONFIG_LDDIR="\"lib/i386-linux-gnu\""
> -DCONFIG_MULTIARCHDIR="\"i386-linux-gnu\"" -DTCC_TARGET_I386 -DONE_SOURCE
> -run ../tcc.c -B.. -I.. -I.. -I../include
> -DCONFIG_LDDIR="\"lib/i386-linux-gnu\""
> -DCONFIG_MULTIARCHDIR="\"i386-linux-gnu\"" -DTCC_TARGET_I386 -DONE_SOURCE
> -run ../tcc.c -B.. -I.. -I.. -I../include
> -DCONFIG_LDDIR="\"lib/i386-linux-gnu\""
> -DCONFIG_MULTIARCHDIR="\"i386-linux-gnu\"" -DTCC_TARGET_I386 -DONE_SOURCE
> -run ../tcc.c -B.. -I.. -I.. -I../include -run ../tests/tcctest.c >
> test.out3 Floating point exception
> make[1]: *** [test3] Error 136
> make[1]: Leaving directory `/home/ramsay/tinycc/tests'
> make: *** [test] Error 2
> address@hidden $
>
> If you run 'git bisect' you will find the culprit is commit 73faaea2
> ("i386-gen: preserve fp control word in gen_cvt_ftoi", 28-08-2013).
>
> Try the following patch and let me know if it fixes it up for you.
>
> ATB,
> Ramsay Jones
>
> --- 8< ---
> From: Ramsay Jones <address@hidden>
> Date: Sat, 7 Sep 2013 22:48:02 +0100
> Subject: [PATCH] libtcc1.c: Fix __asm__() in __tcc_fpinit and __tcc_cvt_ftol
>
> Signed-off-by: Ramsay Jones <address@hidden>
> ---
> lib/libtcc1.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/libtcc1.c b/lib/libtcc1.c
> index a94a82d..a717701 100644
> --- a/lib/libtcc1.c
> +++ b/lib/libtcc1.c
> @@ -482,7 +482,7 @@ long long __ashldi3(long long a, int b)
> void __tcc_fpinit(void)
> {
> unsigned c = 0x137F;
> - __asm__ __volatile__ ("fldcw %0" : "=m" (c));
> + __asm__ __volatile__ ("fldcw %0" : : "m" (c));
> }
> #endif
> long long __tcc_cvt_ftol(long double x)
> @@ -491,9 +491,9 @@ long long __tcc_cvt_ftol(long double x)
> long long ret;
> __asm__ __volatile__ ("fnstcw %0" : "=m" (c0));
> c1 = c0 | 0x0C00;
> - __asm__ __volatile__ ("fldcw %0" : "=m" (c1));
> + __asm__ __volatile__ ("fldcw %0" : : "m" (c1));
> __asm__ __volatile__ ("fistpll %0" : "=m" (ret));
> - __asm__ __volatile__ ("fldcw %0" : "=m" (c0));
> + __asm__ __volatile__ ("fldcw %0" : : "m" (c0));
> return ret;
> }
> #endif /* !__x86_64__ */
The patch looks sound. the memory location operand is indeed an input since
the output is in a x87 FPU control word. I thus applied the patch.
Thanks Ramsay.
Best regards,
Thomas
signature.asc
Description: This is a digitally signed message part.