tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Annoying new warning


From: Christian Jullien
Subject: Re: [Tinycc-devel] Annoying new warning
Date: Sun, 7 May 2017 08:45:12 +0200

Michael,

Thank you for patience with this thread.

Your previous reply was very clear about my mistake. I just wanted to point
out the inconsistency of arm code. Especially if " LDOUBLE_SIZE != 8 is not
possible in any arm config" why is there such a test in arm-gen.c code?
I also would prefer a #if <something> around the struct only used on x86,
but can leave w.o. it.

Anyway, I can be happy with the following patch I can push on mob if you
agree. It compiles w.o warning and pass all tests (+ my own tests on RPi).
IMHO #if !defined(TTC_TARGET_ARM) is not the right test to use, it should be
#if defined(TCC_TARGET_I386) to allow this code *only* on x86 but another
#if would be even better, like #if defined(TCC_LONGDOUBLE_80BITS)

diff --git a/lib/libtcc1.c b/lib/libtcc1.c
index 9195489..63f2cd1 100644
--- a/lib/libtcc1.c
+++ b/lib/libtcc1.c
@@ -76,6 +76,7 @@ typedef long double XFtype;
 #define EXPLD(fp)      (fp.l.upper & 0x7fff)
 #define SIGNLD(fp)     ((fp.l.upper) & 0x8000)

+#if !defined(TCC_TARGET_ARM)
 /* only for x86 */
 union ldouble_long {
     long double ld;
@@ -84,6 +85,7 @@ union ldouble_long {
         unsigned short upper;
     } l;
 };
+#endif

 union double_long {
     double d;
@@ -575,6 +577,7 @@ unsigned long long __fixunsdfdi (double a1)
         return 0;
 }

+#if !defined(TCC_TARGET_ARM)
 unsigned long long __fixunsxfdi (long double a1)
 {
     register union ldouble_long dl1;
@@ -597,6 +600,7 @@ unsigned long long __fixunsxfdi (long double a1)
     else
         return 0;
 }
+#endif

 long long __fixsfdi (float a1)
 {
@@ -612,12 +616,14 @@ long long __fixdfdi (double a1)
     return s ? ret : -ret;
 }

+#if !defined(TCC_TARGET_ARM)
 long long __fixxfdi (long double a1)
 {
     long long ret; int s;
     ret = __fixunsxfdi((s = a1 >= 0) ? a1 : -a1);
     return s ? ret : -ret;
 }
+#endif
-----Original Message-----
From: Tinycc-devel [mailto:address@hidden
On Behalf Of Michael Matz
Sent: dimanche 7 mai 2017 08:22
To: address@hidden
Subject: Re: [Tinycc-devel] Annoying new warning

Hi,

On Sun, 7 May 2017, Christian Jullien wrote:

> Forget one moment what has been said so far and concentrate on my 
> concern with narrowed info.
>
> Facts:

Yes, all known and agreed upon.

> * Finally, arm-gen.c uses TOK___fixxfdi with yet another #if condition 
> => LDOUBLE_SIZE != 8 #if LDOUBLE_SIZE != 8
>    else if(r2 == VT_LDOUBLE)
>      func=TOK___fixxfdi;
>    else if(r2 == VT_DOUBLE)
> #else
>
> So there is at least one combination of compiler/pre-processor options 
> on ARM that may use __fixunsxfdi with a test on a uninitialized value.

LDOUBLE_SIZE != 8 is not possible in any arm config, so the function won't
be actually used at runtime.  That's why your ifdef-ing out of these
functions in libtcc1.c is fine, and it is what we suggested all along. 
(The dead code above should also be cleaned up to not cause further
confusion).

But _read what I write_: you have also disabled some dfdi routines at the
same time in your patch, not only the xfdi ones.  _That_ is the problem, you
have ifdef-ed out other unrelated routines.


Ciao,
Michael.

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