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 07:20:05 +0200

Ok, Michael, Grischka,

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

Facts:

* __fixunsxfdi in lib/libtcc.c issues a warning on ARM because it uses a
struct that was supposed to be used by x86 but no #if insures this

* __fixxfdi is the only function (also in lib/libtcc.c) that calls
__fixunsxfdi

* __fixxfdi is used by tcctok.h protected by a #if defined TCC_TARGET_I386
and used by i386-gen.c (OK not ARM, no issues with it)

* __fixxfdi is used also by tcctok.h protected by
#if defined TCC_TARGET_ARM
# ifdef TCC_ARM_EABI
...
# else
     DEF(TOK___modsi3, "__modsi3")
     DEF(TOK___umodsi3, "__umodsi3")
     DEF(TOK___divsi3, "__divsi3")
     DEF(TOK___udivsi3, "__udivsi3")
     DEF(TOK___floatdisf, "__floatdisf")
     DEF(TOK___floatdidf, "__floatdidf")
#  ifndef TCC_ARM_VFP
     DEF(TOK___floatdixf, "__floatdixf")
     DEF(TOK___fixunssfsi, "__fixunssfsi")
     DEF(TOK___fixunsdfsi, "__fixunsdfsi")
     DEF(TOK___fixunsxfsi, "__fixunsxfsi")
     DEF(TOK___fixxfdi, "__fixxfdi")       <= here!!!
#  endif

* 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.

Not to say that the combination (or lack of combination) for this code is
far from consistent across the different files that use it.

-----Original Message-----
From: Tinycc-devel [mailto:address@hidden
On Behalf Of Michael Matz
Sent: samedi 6 mai 2017 21:28
To: address@hidden
Subject: Re: [Tinycc-devel] Annoying new warning

Hi,

On Sat, 6 May 2017, Christian Jullien wrote:

> I'm a bit confused now. As documented and pointed out by grischka
> /* only for x86 */
> union ldouble_long {
>    long double ld;
>    struct {
>        unsigned long long lower;
>        unsigned short upper;
>    } l;
> };
>
> ldouble_long should only be used by x86. So far so good.
> So I commented out using #if  unsigned long long __fixunsxfdi (long 
> double
> a1) and, by transitive closure
> long long __fixxfdi (long double a1)
> {
>    long long ret; int s;
>    ret = __fixunsxfdi((s = a1 >= 0) ? a1 : -a1);
>    return s ? ret : -ret;
> }

Yes, that you did, and that's right.  But that's not the only thing you did,
look at your patch again.  Your second '#if !defined(TCC_TARGET_ARM)' 
also surrounds and hence on arm comments out the implementations of
__fixunsdfdi, __fixdfdi (after rename/move), and that's wrong.  Note: df,
not xf!


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]