Re: sparse-llvm the result of expression add assign when target is a pointer should be a pointer

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

 



On Sun, Mar 05, 2017 at 07:29:33AM +0000, Dibyendu Majumdar wrote:
> Hi,
> 
> I am starting a new thread on this issue. When processing following
> simple example:
> 
> char *incr(char *p) {
>  char *tmp = p;
>  tmp += 5;
>  return tmp;
> }

There is indeed a problem with this example.
 
> This results in following sequence:
> 
> incr:
> .L000001CB177AD5C8:
>         <entry-point>
>         ptrcast.64  %r3 <- (64) %arg1
>         add.64      %r4 <- %r3, $5
>         cast.64     %r5 <- (64) %r4
>         ret.64      %r5

You must first upgrade to a recent version of sparse as
you seem to not have some fundamental patches here (especially
the patch https://patchwork.kernel.org/patch/9516077/ I've
already talked about it to you). The master branch should be good
the one named 'sparse-next' would be even better.

The linearized code should be:
	incr:
	.L0:
	        <entry-point>
	        cast.64     %r3 <- (64) %arg1
	        add.64      %r4 <- %r3, $5
	        ptrcast.64  %r5 <- (64) %r4
	        ret.64      %r5

Notice the difference in the casts.


-- Luc Van Oostenryck
--
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