| Age | Commit message (Collapse) | Author | Files | Lines |
|
* merge the tests about implicit & explicit casts in a
single file as there was a lot of redundancy.
* shuffle the tests to linear/ or optim/
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
|
|
Conversion to bool is special in C since this conversion
is essentially the result of the comparison with zero.
As such, some operations which are normally unsafe to
do with restricted types, like casting to an unrestricted
type, are in fact safe to do when converting to bool
and issuing a warning in those case is useless, confusing
and causes people to add useless casts in the code in
order to shut up the warning.
Fix this by catching such 'bool <- restricted type' conversion
and avoid such warnings.
CC: Al Viro <viro@zeniv.linux.org.uk>
Originally-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
|
|
The result implicitely depended on longs and/or pointers
being 64 bit or just bigger than ints.
Fix this by running the test with the -m64 flag.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
|
|
Section 6.3.1.2 of the C standard requires that cast to bool
to be done differently than casting to others integer types:
The casted value need to be compared against '0',
if it compares equal the result is 0, otherwise the result is 1.
But currently, it's treated as the others integer casts: the value is
truncated, keeping only the least significant bit.
For example, when using test-linearize on the following code:
_Bool foo(int a) { return (_Bool) a; }
this instruction is emitted:
scast.1 %r2 <- (32) %arg1
while the correct one is:
setne.1 %r2 <- %arg1, $0
Fix this for explicit and implicit casts.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
|