History

Cast signed pointer offset to ptrdiff_t before performing arithmetic

Affects 32-bit platforms.

Aleksi Hannula committed 9 months ago

Commit 5ad52cc1 parent c9370951 file · +3 −0Browse files

Unified · Split

tccgen.c+3−0
@@ -3097,6 +3097,9 @@ op_err: · 3096 unmodified lines
30973097 #endif
30983098 type1 = vtop[-1].type;
30993099 vpush_type_size(pointed_type(&vtop[-1].type), &align);
3100+ if (!(vtop[-1].type.t & VT_UNSIGNED)) {
3101+ gen_cast_s(VT_PTRDIFF_T);
3102+ }
31003103 gen_op('*');
31013104 #ifdef CONFIG_TCC_BCHECK
31023105 if (tcc_state->do_bounds_check && !CONST_WANTED) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t