Make sizeof() be of type size_t
This matters when sizeof is directly used in arithmetic, ala "uintptr_t t; t &= -sizeof(long)" (for alignment). When sizeof isn't size_t (as it's specified to be) this masking will truncate the high bits of the uintptr_t object (if uintptr_t is larger than uint).
This commit is contained in:
6
libtcc.c
6
libtcc.c
@ -745,6 +745,12 @@ static int tcc_compile(TCCState *s1)
|
||||
char_pointer_type.t = VT_BYTE;
|
||||
mk_pointer(&char_pointer_type);
|
||||
|
||||
#if PTR_SIZE == 4
|
||||
size_type.t = VT_INT;
|
||||
#else
|
||||
size_type.t = VT_LLONG;
|
||||
#endif
|
||||
|
||||
func_old_type.t = VT_FUNC;
|
||||
func_old_type.ref = sym_push(SYM_FIELD, &int_type, FUNC_CDECL, FUNC_OLD);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user