Unified · Split
| @@ -6228,7 +6228,7 @@ static void gen_cast(CType *type) · 6227 unmodified lines | |||
| 6228 | vpop(); | 6228 | vpop(); |
| 6229 | #else | 6229 | #else |
| 6230 | int r = gv(RC_INT); | 6230 | int r = gv(RC_INT); |
| 6231 | if (sbt != (VT_INT | VT_UNSIGNED)) { | 6231 | if (sbt != (VT_INT | VT_UNSIGNED) && sbt != VT_PTR) { |
| 6232 | /* x86_64 specific: movslq */ | 6232 | /* x86_64 specific: movslq */ |
| 6233 | o(0x6348); | 6233 | o(0x6348); |
| 6234 | o(0xc0 + (REG_VALUE(r) << 3) + REG_VALUE(r)); | 6234 | o(0xc0 + (REG_VALUE(r) << 3) + REG_VALUE(r)); |
| @@ -1109,6 +1109,8 @@ void cast_test() · 1108 unmodified lines | |||
| 1109 | char tab[10]; | 1109 | char tab[10]; |
| 1110 | unsigned b,d; | 1110 | unsigned b,d; |
| 1111 | short s; | 1111 | short s; |
| 1112 | char *p = NULL; | ||
| 1113 | p -= 0x700000000042; | ||
| 1112 | 1114 | ||
| 1113 | printf("cast_test:\n"); | 1115 | printf("cast_test:\n"); |
| 1114 | a = 0xfffff; | 1116 | a = 0xfffff; |
| @@ -1150,6 +1152,14 @@ void cast_test() · 35 unmodified lines | |||
| 1150 | printf("sizeof(+(char)'a') = %d\n", sizeof(+(char)'a')); | 1152 | printf("sizeof(+(char)'a') = %d\n", sizeof(+(char)'a')); |
| 1151 | printf("sizeof(-(char)'a') = %d\n", sizeof(-(char)'a')); | 1153 | printf("sizeof(-(char)'a') = %d\n", sizeof(-(char)'a')); |
| 1152 | printf("sizeof(~(char)'a') = %d\n", sizeof(-(char)'a')); | 1154 | printf("sizeof(~(char)'a') = %d\n", sizeof(-(char)'a')); |
| 1155 | |||
| 1156 | /* from pointer to integer types */ | ||
| 1157 | printf("%d %d %d %d %d %d %ld %ld %lld %lld\n", | ||
| 1158 | (char)p, (unsigned char)p, | ||
| 1159 | (short)p, (unsigned short)p, | ||
| 1160 | (int)p, (unsigned int)p, | ||
| 1161 | (long)p, (unsigned long)p, | ||
| 1162 | (long long)p, (unsigned long long)p); | ||
| 1153 | } | 1163 | } |
| 1154 | 1164 | ||
| 1155 | /* initializers tests */ | 1165 | /* initializers tests */ |