Change the way struct CStrings are handled.

A CString used to be copied into a token string, which is an int array.
On a 64-bit architecture the pointers were misaligned, so ASan gave
lots of warnings. On a 64-bit architecture that required memory
accesses to be correctly aligned it would not work at all.

The CString is now included in CValue instead.
This commit is contained in:
Edmund Grimley Evans
2015-11-21 11:23:53 +00:00
parent 4886d2c640
commit 1c2dfa1f4b
6 changed files with 67 additions and 66 deletions

6
tcc.h
View File

@ -400,7 +400,11 @@ typedef union CValue {
double d;
float f;
uint64_t i;
struct CString *cstr;
struct {
int size;
const void *data;
void *data_allocated;
} str;
int tab[LDOUBLE_SIZE/4];
} CValue;