History

Fixes for issues I've just found/introduced to x86 TCC.

- Cast from pointer to long long makes TCC output an error. Use cast to int before we apply shift operation for a pointer value. - Removed test cases for casts from pointer to char/short because they produce warning.

Shinichiro Hamaji committed 17 years ago

Commit 83fd3631 parent be43c8e2 files · +6 −3Browse files

Unified · Split

2 files
  1. tcc.c +5 −0
  2. tcctest.c +1 −3
tcc.c+5−0
@@ -6219,6 +6219,11 @@ static void gen_cast(CType *type) · 6218 unmodified lines
6219 vpushi(0);6219 vpushi(0);
6220 gv(RC_INT);6220 gv(RC_INT);
6221 } else {6221 } else {
6222 if (sbt == VT_PTR) {
6223 /* cast from pointer to int before we apply
6224 shift operation, which pointers don't support*/
6225 gen_cast(&int_type);
6226 }
6222 gv_dup();6227 gv_dup();
6223 vpushi(31);6228 vpushi(31);
6224 gen_op(TOK_SAR);6229 gen_op(TOK_SAR);
tcctest.c+1−3
@@ -1154,9 +1154,7 @@ void cast_test() · 1153 unmodified lines
1154 printf("sizeof(~(char)'a') = %d\n", sizeof(-(char)'a'));1154 printf("sizeof(~(char)'a') = %d\n", sizeof(-(char)'a'));
1155 1155
1156 /* from pointer to integer types */1156 /* from pointer to integer types */
1157 printf("%d %d %d %d %d %d %ld %ld %lld %lld\n",1157 printf("%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,1158 (int)p, (unsigned int)p,
1161 (long)p, (unsigned long)p,1159 (long)p, (unsigned long)p,
1162 (long long)p, (unsigned long long)p);1160 (long long)p, (unsigned long long)p);

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