History

update gen_cast

grischka committed 6 years ago

Commit 89372dc1 parent 35475b510 files · +371 −278Browse files

Showing the changes to tests (4 of 10 files). Show all

Unified · Split

4 files
  1. tests/Makefile +1 −0
  2. tests/tcctest.c +52 −6
  3. tests/tests2/88_codeopt.c +1 −1
  4. tests/tests2/96_nodata_wanted.expect +1 −1
tests/Makefile+1−0
@@ -269,6 +269,7 @@ cross-test : · 268 unmodified lines
269 $(TOP)/arm-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"269 $(TOP)/arm-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
270 $(TOP)/arm-wince-tcc$(EXESUF) $(TCCFLAGS-win) -c $(TOPSRC)/examples/ex3.c && echo "ok"270 $(TOP)/arm-wince-tcc$(EXESUF) $(TCCFLAGS-win) -c $(TOPSRC)/examples/ex3.c && echo "ok"
271 $(TOP)/arm64-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"271 $(TOP)/arm64-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
272 $(TOP)/riscv64-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
272 $(TOP)/c67-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"273 $(TOP)/c67-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
273 $(TOP)/i386-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok"274 $(TOP)/i386-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok"
274 $(TOP)/x86_64-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok"275 $(TOP)/x86_64-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok"
tests/tcctest.c+52−6
@@ -16,6 +16,10 @@ · 15 unmodified lines
16 16
17#endif17#endif
18 18
19#ifndef __TINYC__
20typedef __SIZE_TYPE__ uintptr_t;
21#endif
22
19#if defined(_WIN32)23#if defined(_WIN32)
20#define LONG_LONG_FORMAT "%lld"24#define LONG_LONG_FORMAT "%lld"
21#define ULONG_LONG_FORMAT "%llu"25#define ULONG_LONG_FORMAT "%llu"
@@ -1163,7 +1167,7 @@ void struct_test() · 1141 unmodified lines
1163 s->f3 = 1;1167 s->f3 = 1;
1164 printf("st2: %d %d %d\n",1168 printf("st2: %d %d %d\n",
1165 s->f1, s->f2, s->f3);1169 s->f1, s->f2, s->f3);
1166 printf("str_addr=%x\n", (int)st1.str - (int)&st1.f1);1170 printf("str_addr=%x\n", (int)(uintptr_t)st1.str - (int)(uintptr_t)&st1.f1);
1167 1171
1168 /* align / size tests */1172 /* align / size tests */
1169 printf("aligntest1 sizeof=%d alignof=%d\n",1173 printf("aligntest1 sizeof=%d alignof=%d\n",
@@ -1203,10 +1207,17 @@ void struct_test() · 33 unmodified lines
1203 printf("Large: offsetof(compound_head)=%d\n", (int)((char*)&ls.compound_head - (char*)&ls));1207 printf("Large: offsetof(compound_head)=%d\n", (int)((char*)&ls.compound_head - (char*)&ls));
1204}1208}
1205 1209
1210/* simulate char/short return value with undefined upper bits */
1211static int __csf(int x) { return x; }
1212static void *_csf = __csf;
1213#define csf(t,n) ((t(*)(int))_csf)(n)
1214
1206/* XXX: depend on endianness */1215/* XXX: depend on endianness */
1207void char_short_test()1216void char_short_test()
1208{1217{
1209 int var1, var2;1218 int var1, var2;
1219 char var3;
1220 long long var4;
1210 1221
1211 printf("char_short:\n");1222 printf("char_short:\n");
1212 1223
@@ -1230,6 +1241,34 @@ void char_short_test() · 17 unmodified lines
1230 printf("var1=%x\n", var1);1241 printf("var1=%x\n", var1);
1231 *(int *)&var1 = 0x08090a0b;1242 *(int *)&var1 = 0x08090a0b;
1232 printf("var1=%x\n", var1);1243 printf("var1=%x\n", var1);
1244
1245 var1 = 0x778899aa;
1246 var4 = 0x11223344aa998877ULL;
1247 var1 = var3 = var1 + 1;
1248 var4 = var3 = var4 + 1;
1249 printf("promote char/short assign %d "LONG_LONG_FORMAT"\n", var1, var4);
1250 var1 = 0x778899aa;
1251 var4 = 0x11223344aa998877ULL;
1252 printf("promote char/short assign VA %d %d\n", var3 = var1 + 1, var3 = var4 + 1);
1253 printf("promote char/short cast VA %d %d\n", (char)(var1 + 1), (char)(var4 + 1));
1254 var1 = csf(unsigned char,0x89898989);
1255 var4 = csf(char,0xabababab);
1256 printf("promote char/short funcret %d "LONG_LONG_FORMAT"\n", var1, var4);
1257 printf("promote char/short fumcret VA %d %d %d %d\n",
1258 csf(unsigned short,0xcdcdcdcd),
1259 csf(short,0xefefefef),
1260 csf(_Bool,0x33221100),
1261 csf(_Bool,0x33221101));
1262 var3 = -10;
1263 var1 = (char)(unsigned char)(var3 + 1);
1264 var4 = (char)(unsigned char)(var3 + 1);
1265 printf("promote multicast (char)(unsigned char) %d "LONG_LONG_FORMAT"\n", var1, var4);
1266 var4 = 0x11223344aa998877ULL;
1267 var4 = (unsigned)(int)(var4 + 1);
1268 printf("promote multicast (unsigned)(int) "LONG_LONG_FORMAT"\n", var4);
1269 var4 = 0x11223344bbaa9988ULL;
1270 var4 = (unsigned)(char)(var4 + 1);
1271 printf("promote multicast (unsigned)(char) "LONG_LONG_FORMAT"\n", var4);
1233}1272}
1234 1273
1235/******************/1274/******************/
@@ -1679,6 +1718,10 @@ void cast_test() · 443 unmodified lines
1679 printf("sizeof(-(char)'a') = %d\n", sizeof(-(char)'a'));1718 printf("sizeof(-(char)'a') = %d\n", sizeof(-(char)'a'));
1680 printf("sizeof(~(char)'a') = %d\n", sizeof(-(char)'a'));1719 printf("sizeof(~(char)'a') = %d\n", sizeof(-(char)'a'));
1681 1720
1721#ifdef __TINYC__
1722# pragma comment(option, "-w")
1723#endif
1724
1682 /* from pointer to integer types */1725 /* from pointer to integer types */
1683 printf("%d %d %ld %ld %lld %lld\n",1726 printf("%d %d %ld %ld %lld %lld\n",
1684 (int)p, (unsigned int)p,1727 (int)p, (unsigned int)p,
@@ -1689,6 +1732,10 @@ void cast_test() · 4 unmodified lines
1689 printf("%p %p %p %p\n",1732 printf("%p %p %p %p\n",
1690 (void *)a, (void *)b, (void *)c, (void *)d);1733 (void *)a, (void *)b, (void *)c, (void *)d);
1691 1734
1735#ifdef __TINYC__
1736# pragma comment(option, "-W")
1737#endif
1738
1692 /* int to int with sign set */1739 /* int to int with sign set */
1693 printf("0x%lx\n", (unsigned long)(int)ul);1740 printf("0x%lx\n", (unsigned long)(int)ul);
1694}1741}
@@ -2347,7 +2394,7 @@ void funcptr_test() · 652 unmodified lines
2347 2394
2348 /* Check that we can align functions */2395 /* Check that we can align functions */
2349 func = aligned_function;2396 func = aligned_function;
2350 printf("aligned_function (should be zero): %d\n", ((int)func) & 15);2397 printf("aligned_function (should be zero): %d\n", ((int)(uintptr_t)func) & 15);
2351}2398}
2352 2399
2353void lloptest(long long a, long long b)2400void lloptest(long long a, long long b)
@@ -2549,6 +2596,9 @@ void longlong_test(void) · 195 unmodified lines
2549 unsigned long long u = 0x8000000000000001ULL;2596 unsigned long long u = 0x8000000000000001ULL;
2550 u = (unsigned)(u + 1);2597 u = (unsigned)(u + 1);
2551 printf("long long u=" ULONG_LONG_FORMAT "\n", u);2598 printf("long long u=" ULONG_LONG_FORMAT "\n", u);
2599 u = 0x11223344aa998877ULL;
2600 u = (unsigned)(int)(u + 1);
2601 printf("long long u=" ULONG_LONG_FORMAT "\n", u);
2552 2602
2553 /* was a problem with missing save_regs in gen_opl on 32-bit platforms */2603 /* was a problem with missing save_regs in gen_opl on 32-bit platforms */
2554 char cc = 78;2604 char cc = 78;
@@ -2897,10 +2947,6 @@ void c99_vla_test(int size1, int size2) · 342 unmodified lines
2897#endif2947#endif
2898}2948}
2899 2949
2900#ifndef __TINYC__
2901typedef __SIZE_TYPE__ uintptr_t;
2902#endif
2903
2904void sizeof_test(void)2950void sizeof_test(void)
2905{2951{
2906 int a;2952 int a;
tests/tests2/88_codeopt.c+1−1
@@ -1,7 +1,7 @@
1/* Check some way in where code suppression caused various1/* Check some way in where code suppression caused various
2 miscompilations. */2 miscompilations. */
3extern int printf (const char *, ...);3extern int printf (const char *, ...);
4typedef unsigned long size_t;4typedef __SIZE_TYPE__ size_t;
5 5
6size_t _brk_start, _brk_end;6size_t _brk_start, _brk_end;
7void * extend_brk(size_t size, size_t align)7void * extend_brk(size_t size, size_t align)
tests/tests2/96_nodata_wanted.expect+1−1
@@ -9,7 +9,7 @@ · 8 unmodified lines
9 9
10[test_local_data_noerror]10[test_local_data_noerror]
1196_nodata_wanted.c:25: warning: assignment makes integer from pointer without a cast1196_nodata_wanted.c:25: warning: assignment makes integer from pointer without a cast
1296_nodata_wanted.c:25: warning: nonportable conversion from pointer to char/short1296_nodata_wanted.c:25: warning: cast between pointer and integer of different size
13 13
14[test_data_suppression_off]14[test_data_suppression_off]
15data:15data:

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