diff options
| author | Michael Matz <matz@suse.de> | 2016-09-03 23:23:13 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:47:11 +0100 |
| commit | 49bb5a7e06049c771a28a2cc507c7789dc54a88b (patch) | |
| tree | cb865f97ddb043b5562c5688c1219352931deb59 /tests/tcctest.c | |
| parent | 5bd8aeb917ed326f50b1ed45669a1cf40aca75a3 (diff) | |
| download | tinycc-49bb5a7e06049c771a28a2cc507c7789dc54a88b.tar.gz tinycc-49bb5a7e06049c771a28a2cc507c7789dc54a88b.tar.bz2 | |
Fix __builtin_constant_p(1000/x)
was incorrectly treated as constant because the vpop removed
all traces of non-constness.
Diffstat (limited to 'tests/tcctest.c')
| -rw-r--r-- | tests/tcctest.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c index b8e534f..daf788c 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -1082,6 +1082,14 @@ static int toupper1(int a) return TOUPPER(a); } +static unsigned int calc_vm_flags(unsigned int prot) +{ + unsigned int prot_bits; + /* This used to segfault in some revisions: */ + prot_bits = ((0x1==0x00000001)?(prot&0x1):(prot&0x1)?0x00000001:0); + return prot_bits; +} + void bool_test() { int *s, a, b, t, f, i; @@ -1154,6 +1162,7 @@ void bool_test() if (toupper1 (i) != TOUPPER (i)) printf("error %d\n", i); } + printf ("bits = 0x%x\n", calc_vm_flags (0x1)); } /* GCC accepts that */ @@ -2880,6 +2889,7 @@ void builtin_test(void) printf("res = %d\n", __builtin_constant_p(1 + 2)); printf("res = %d\n", __builtin_constant_p(&constant_p_var)); printf("res = %d\n", __builtin_constant_p(constant_p_var)); + printf("res = %d\n", __builtin_constant_p(100000 / constant_p_var)); s = 1; ll = 2; i = __builtin_choose_expr (1 != 0, ll, s); |
