diff options
| author | Jan Pokorný <pokorny_jan@seznam.cz> | 2012-05-10 03:07:47 -0700 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2012-05-10 03:07:47 -0700 |
| commit | 955cd225d2e3ee708e20de825eca82c8797897fd (patch) | |
| tree | 810055d62f0206440dc2132b69d109ae0186efb4 /Documentation | |
| parent | 695dd9d068dd2316b92706d174df9e30c1e71dcf (diff) | |
| download | sparse-dev-955cd225d2e3ee708e20de825eca82c8797897fd.tar.gz | |
simplify: conservative handling of casts with pointers
On 05/08/2012 04:13 PM, Jan Pokorný wrote:
> When the cast is optimized out/target pointer type information lost,
> it may be impossible for backend to recover it (think of
> "struct foo *my_new_foo = malloc(sizeof(*my_new_foo))").
>
> Losing such pointer type information can be wider issue (structs and
> unions maybe), but this is the most exposed one and the patch tries
> to be minimal in this regard and the impact seems to be minimal
> too as usually type-correctness is followed.
I expected that if both operands of the cast appear to be pointers, it is
always OP_PTRCAST case, which is not true.
So this version exchanges inequality test for "or". Beside being
shorter, it covers such previously missed cases.
Based on asserts I experimented with, OP_PTRCASTs are always captured
by the condition implicitly (beside OP_CASTs with pointer-like operands).
Signed-off-by: Jan Pokorný <pokorny_jan@seznam.cz>
Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions
