diff options
| author | Michael Matz <matz@suse.de> | 2012-04-14 23:50:21 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2012-04-18 20:57:13 +0200 |
| commit | 6471ec0a2bd523edd4bbc79277a33d0b853940fa (patch) | |
| tree | 5a907084e0d9dc696d481e6380a53d893aad131c /tests/tcctest.c | |
| parent | f98c2306a0857ad3f8800f91e0554a27adc7f675 (diff) | |
| download | tinycc-6471ec0a2bd523edd4bbc79277a33d0b853940fa.tar.gz tinycc-6471ec0a2bd523edd4bbc79277a33d0b853940fa.tar.bz2 | |
Fix conversion in a?0:ptr.
(cond ? 0 : ptr)->member wasn't handled correctly. If one arm
is a null pointer constant (which also can be a pointer) the result
type is that of the other arm.
Diffstat (limited to 'tests/tcctest.c')
| -rw-r--r-- | tests/tcctest.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c index f0d82cf..723adc1 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -2486,3 +2486,16 @@ void const_warn_test(void) { const_func(1); } + +struct condstruct { + int i; +}; + +int getme (struct condstruct *s, int i) +{ + int i1 = (i == 0 ? 0 : s)->i; + int i2 = (i == 0 ? s : 0)->i; + int i3 = (i == 0 ? (void*)0 : s)->i; + int i4 = (i == 0 ? s : (void*)0)->i; + return i1 + i2 + i3 + i4; +} |
