aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard>2006-10-28 14:47:14 +0000
committerbellard <bellard>2006-10-28 14:47:14 +0000
commit65b974e396288c21e0a62aba4a346717fde12060 (patch)
tree2d7a21bcecf13d51d5bae5969e621b96ca71f1e3
parent365d0ad545341aa85e7ded45a7a4b0f8a49ced47 (diff)
downloadtinycc-65b974e396288c21e0a62aba4a346717fde12060.tar.gz
tinycc-65b974e396288c21e0a62aba4a346717fde12060.tar.bz2
conversion test
-rw-r--r--tcctest.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tcctest.c b/tcctest.c
index 0d93af6..fca987d 100644
--- a/tcctest.c
+++ b/tcctest.c
@@ -1073,6 +1073,8 @@ void cast_test()
int a;
char c;
char tab[10];
+ unsigned b,d;
+ short s;
printf("cast_test:\n");
a = 0xfffff;
@@ -1095,7 +1097,15 @@ void cast_test()
printf("%d\n", a);
printf("sizeof(c) = %d, sizeof((int)c) = %d\n", sizeof(c), sizeof((int)c));
-
+
+ /* test cast from unsigned to signed short to int */
+ b = 0xf000;
+ d = (short)b;
+ printf("((unsigned)(short)0x%08x) = 0x%08x\n", b, d);
+ b = 0xf0f0;
+ d = (char)b;
+ printf("((unsigned)(char)0x%08x) = 0x%08x\n", b, d);
+
/* test implicit int casting for array accesses */
c = 0;
tab[1] = 2;