Re: [PATCH] simplify: conservative handling of casts with pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 9, 2012 at 4:00 AM, Jan Pokorný <pokorny_jan@xxxxxxxxx> wrote:
> 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).

The early sparse back end does not care about preserve the
ctype in the back end. The type has been simplify to bit size.
So the pointer type conversion which has the same bit size,
it does not need to generate any back end machine code
e.g. x86 instruction to perform the conversion. I think that
is why it is skipped.

The recent changes, especially the llvm back end care more
about preserving the ctype in the back end instruction level.

The patch is applied.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux