struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tcc / 88_codeopt.c
blob2ab4c8a8c1682257b15b184bbb99319ef6b2a9d3
1 /* Check some way in where code suppression caused various
2 miscompilations. */
3 extern int printf (const char *, ...);
4 typedef __SIZE_TYPE__ size_t;
6 size_t _brk_start, _brk_end;
7 void * extend_brk(size_t size, size_t align)
9 size_t mask = align - 1;
10 void *ret = 0;
12 do {
13 if (__builtin_expect(!!(_brk_start == 0), 0))
14 do {
15 printf("wrong1\n");
16 } while (0);
17 } while (0);
18 _brk_end = (_brk_end + mask) & ~mask;
19 ret = (void *)_brk_end;
20 _brk_end += size;
22 return ret;
25 static void get_args (int a, int b)
27 if (a != 1)
28 printf("wrong2\n");
29 else
30 printf("okay\n");
33 void bla(void)
35 int __ret = 42;
37 if (__builtin_expect(!!(0), 0)) {
38 if (__builtin_expect(!!__ret, 0))
39 printf("wrong3\n");
40 int x = !!(__ret);
42 __ret;
43 });
44 get_args(!!__ret, sizeof(__ret));
47 _Bool chk(unsigned long addr, unsigned long limit, unsigned long size)
49 _Bool ret;
50 /* This just needs to compile, no runtime test. (And it doesn't compile
51 only with certain internal checking added that's not committed). */
52 if (0)
53 ret = 0 != (!!(addr > limit - size));
54 return 0;
57 int main()
59 void *r;
60 _brk_start = 1024;
61 _brk_end = 1024;
62 r = extend_brk (4096, 16);
63 if (!r)
64 printf("wrong4\n");
65 else
66 printf("okay\n");
67 bla();
68 return 0;