tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Compilation of tcc with clang


From: Thomas Preud'homme
Subject: Re: [Tinycc-devel] Compilation of tcc with clang
Date: Tue, 6 Mar 2012 13:51:06 +0100
User-agent: KMail/1.13.7 (Linux/3.2.0-1-amd64; KDE/4.6.5; x86_64; ; )

Le mardi 6 mars 2012 13:05:40, Christian Jullien a écrit :
> Hello Thomas,
> 
> If your heart is in good health, you can also try splint on source code.
> 
> The reported warning is true because cv is a CValue defined as
> 
> typedef union CValue {
>     long double ld;
>     double d;
>     float f;
>     int i;
>     unsigned int ui;
>     unsigned int ul; /* address (should be unsigned long on 64 bit cpu) */
>     long long ll;
>     unsigned long long ull;
>     struct CString *cstr;
>     void *ptr;
>     int tab[2];
> } CValue;
> 
> But, since CValue is an union, sizeof(CValue) == sizeof(greatest field)
> which is probably "long double"
> To me, this is a real warning, but the code itself is safe.
> To fix it, CValue should be defined with int tab[LDOUBLE_SIZE / 2] or
> something similar.
Indeed, I didn't pay attention it was an union. I looked at it quickly but 
considerid it as a struct. My bad, I used this structure before and noticed it 
is an union at the time.

There is also a warning about a %Lu in tccpp.c but this does not explain the 
segfault. I should try running a debugger to see if it can help.

Best regards,
> 
> Christian.

Thomas Preud'homme

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]