If the destination is an indirect pointer access (which ends up as VT_LLOCAL) the intermediate pointer must be loaded as VT_PTR, not as whatever the pointed to type is.
Unified · Split
| @@ -1605,8 +1605,10 @@ ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands, · 1604 unmodified lines | ||
| 1605 | 1605 | SValue sv; |
| 1606 | 1606 | sv = *op->vt; |
| 1607 | 1607 | sv.r = (sv.r & ~VT_VALMASK) | VT_LOCAL; |
| 1608 | + sv.type.t = VT_PTR; | |
| 1608 | 1609 | load(out_reg, &sv); |
| 1609 | 1610 | |
| 1611 | + sv = *op->vt; | |
| 1610 | 1612 | sv.r = (sv.r & ~VT_VALMASK) | out_reg; |
| 1611 | 1613 | store(op->reg, &sv); |
| 1612 | 1614 | } |
| @@ -2909,10 +2909,15 @@ char * get_asm_string (void) · 2908 unmodified lines | ||
| 2909 | 2909 | |
| 2910 | 2910 | unsigned int set; |
| 2911 | 2911 | |
| 2912 | +void fancy_copy (unsigned *in, unsigned *out) | |
| 2913 | +{ | |
| 2914 | + asm volatile ("" : "=r" (*out) : "0" (*in)); | |
| 2915 | +} | |
| 2916 | + | |
| 2912 | 2917 | void asm_test(void) |
| 2913 | 2918 | { |
| 2914 | 2919 | char buf[128]; |
| 2915 | − unsigned int val; | |
| 2920 | + unsigned int val, val2; | |
| 2916 | 2921 | struct struct123 s1; |
| 2917 | 2922 | struct struct1231 s2 = { (unsigned long)&s1 }; |
| 2918 | 2923 | /* Hide the outer base_func, but check later that the inline |
| @@ -2979,6 +2984,9 @@ void asm_test(void) · 60 unmodified lines | ||
| 2979 | 2984 | printf("asmbool: failed\n"); |
| 2980 | 2985 | #endif |
| 2981 | 2986 | printf("asmstr: %s\n", get_asm_string()); |
| 2987 | + val = 43; | |
| 2988 | + fancy_copy (&val, &val2); | |
| 2989 | + printf ("fancycpy(%d)=%d\n", val, val2); | |
| 2982 | 2990 | return; |
| 2983 | 2991 | label1: |
| 2984 | 2992 | goto label2; |