int (*fn1)=0x13fde16b5; and int fn1(int a) {...} struct { int (*fn2)(int a); } b = { fn1 };
Unified · Split
| @@ -446,7 +446,7 @@ ST_FUNC void vpush_global_sym(CType *type, int v) · 445 unmodified lines | ||
| 446 | 446 | |
| 447 | 447 | ST_FUNC void vset(CType *type, int r, int v) |
| 448 | 448 | { |
| 449 | − CValue cval; | |
| 449 | + CValue cval = {0}; | |
| 450 | 450 | |
| 451 | 451 | cval.i = v; |
| 452 | 452 | vsetc(type, r, &cval); |
| @@ -1955,7 +1955,9 @@ static void gen_cast(CType *type) · 1502 unmodified lines | ||
| 1955 | 1955 | s = 24; |
| 1956 | 1956 | else if ((dbt & VT_BTYPE) == VT_SHORT) |
| 1957 | 1957 | s = 16; |
| 1958 | − | |
| 1958 | +#ifdef TCC_TARGET_X86_64 | |
| 1959 | + if (!(dbt & (VT_PTR|VT_LLONG|VT_FUNC|VT_STRUCT))) | |
| 1960 | +#endif | |
| 1959 | 1961 | if(dbt & VT_UNSIGNED) |
| 1960 | 1962 | vtop->c.ui = ((unsigned int)vtop->c.ll << s) >> s; |
| 1961 | 1963 | else |
| @@ -3906,7 +3908,11 @@ ST_FUNC void unary(void) · 1944 unmodified lines | ||
| 3906 | 3908 | /* if forward reference, we must point to s */ |
| 3907 | 3909 | if (vtop->r & VT_SYM) { |
| 3908 | 3910 | vtop->sym = s; |
| 3909 | − vtop->c.ul = 0; | |
| 3911 | +#ifdef TCC_TARGET_X86_64 | |
| 3912 | + s1->vtop->c.ull = 0; | |
| 3913 | +#else | |
| 3914 | + s1->vtop->c.ul = 0; | |
| 3915 | +#endif | |
| 3910 | 3916 | } |
| 3911 | 3917 | break; |
| 3912 | 3918 | } |
| @@ -5120,6 +5126,12 @@ static void init_putv(CType *type, Section *sec, unsigned long c, · 1207 unmodified lines | ||
| 5120 | 5126 | case VT_LLONG: |
| 5121 | 5127 | *(long long *)ptr |= (vtop->c.ll & bit_mask) << bit_pos; |
| 5122 | 5128 | break; |
| 5129 | + case VT_PTR: | |
| 5130 | + if (s1->vtop->r & VT_SYM) { | |
| 5131 | + greloc(s1, sec, s1->vtop->sym, c, R_DATA_PTR); | |
| 5132 | + } | |
| 5133 | + *(addr_t *)ptr |= (s1->vtop->c.ull & bit_mask) << bit_pos; | |
| 5134 | + break; | |
| 5123 | 5135 | default: |
| 5124 | 5136 | if (vtop->r & VT_SYM) { |
| 5125 | 5137 | greloc(sec, vtop->sym, c, R_DATA_PTR); |