Re: [PATCH] fix dominance testing of mixed types

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

 



On Mon, Mar 19, 2018 at 02:19:51AM -0700, Christopher Li wrote:
> On Sun, Mar 18, 2018 at 6:55 AM, Luc Van Oostenryck
> <luc.vanoostenryck@xxxxxxxxx> wrote:
> > The function dominates() is used to test the dominance of
> > one instruction over another one. To do this different things
> > need to be checked, like:
> > - same symbol or not
> > - same address & same offset
> > - partial overlapping
> >
> > One case is not covered though: when type cohercion is done
> > via a pointer to an union (IOW when a memory location is used
> > to store one type and is then read back as another type).
> > For example, the location is first stored as a float and then is
> > read back as an integer of the same size. Currently, sparse
> > will consider that the store effectively dominates the load
> > which will then allow to simplify away the load and use the
> > pseudo holding the float value for the expected integer.

...

> > Note: this solution is probably incomplete. For example, what
> >       about compound types?
> 
> Thanks for the patch. The test case is definitly good to have.
> The solution looks likely work for your test case.
> 
> The more general topic is pointer alias analyse.

But AA is irrelevant to the problem here. AA will tell you *if*
two pointers may or must alias each other. This is needed for a
number of things but the problem here is different: we already
*know* that (or only concerned when) the two locations *are* the
same (if there is a doubt about this  dominates() returns -1)
but still we must not conclude that the store dominates the load.
In fact, we can conclude that it dominates if we want so, but
what must not be done is the corresponding memop simplification.

The patch cover the case 'floating-point against anything else'
and my question was along the line:
    What if we have more complex situations with *same*
    location but mixed types? What are the memop simplifications
    that may be done and which must not be done?
For example what if we have an union of union or an union holding
a struct holding an union of a int & a float (all of the same size)?

I have the feeling that this test should move where the memop
simplification is done. I'll see.

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