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.
Christian.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Thomas Preud'homme
Sent: mardi 6 mars 2012 12:16
To: [email protected]
Subject: [Tinycc-devel] Compilation of tcc with clang
Greetings everybody,
a rebuild of Debian with clang was done recently and it led to a
segmentation fault for tcc when running the test. Also, several warning were
issued by clang, which is better than gcc for static analysis as far as I
know. The full log is attached to this email.
An example of warning:
tccpp.c:924:22: warning: array index of '2' indexes past the end of an array
(that contains 2 elements) [-Warray-bounds]
str[len++] = cv->tab[2];
I didn't look more into it as I lack of time these days.
Best regards,
Thomas Preud'homme
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel