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: Sat, 6 May 2017 08:11:11 +0200

Thank Matz.

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;
}

Which looks to be called by arm-gen.c:      func=TOK___fixxfdi;

Is it?

I'm puzzled!! To me, there is a calling chain on ARM that arrives to
__fixunsxfdi which produces an undefined result depending on an
uninitialized variable.

See for example:
#  ifndef TCC_ARM_VFP
     DEF(TOK___floatdixf, "__floatdixf")
     DEF(TOK___fixunssfsi, "__fixunssfsi")
     DEF(TOK___fixunsdfsi, "__fixunsdfsi")
     DEF(TOK___fixunsxfsi, "__fixunsxfsi")
     DEF(TOK___fixxfdi, "__fixxfdi")
#  endif

And

#if LDOUBLE_SIZE != 8
    else if(r2 == VT_LDOUBLE)
      func=TOK___fixxfdi;
    else if(r2 == VT_DOUBLE)
#else
    else if(r2 == VT_LDOUBLE || r2 == VT_DOUBLE)
#endif
      func=TOK___fixdfdi;
  }
-----Original Message-----
From: Tinycc-devel [mailto:address@hidden
On Behalf Of Michael Matz
Sent: samedi 6 mai 2017 07:24
To: address@hidden
Subject: Re: [Tinycc-devel] Annoying new warning

Hi,


On Sat, 6 May 2017, Christian Jullien wrote:

> Using your advice, I added #if !defined(TCC_TARGET_ARM) around all 
> code directly or indirectly using ldouble_long which solved warning.

But you now also ifdefed out __fixunsdfdi and __fixdfdi.  That can't work,
they are called from the backend:

> +#if !defined(TCC_TARGET_ARM)

Here you start the ifdef ...

> unsigned long long __fixunsdfdi (double a1)

... so this, ...

> {
>     register union double_long dl1;
> @@ -598,24 +601,25 @@ unsigned long long __fixunsxfdi (long double a1)
>         return 0;
> }
>
> -long long __fixsfdi (float a1)
> +long long __fixdfdi (double a1)

... this ...

> -long long __fixdfdi (double a1)
> +long long __fixxfdi (long double a1)

... and this are commented out.  Only the last one and __fixunsxfdi should
be.


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]