https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103121

--- Comment #28 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 20 Jan 2022, msebor at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103121
> 
> --- Comment #26 from Martin Sebor <msebor at gcc dot gnu.org> ---
> (In reply to rguent...@suse.de from comment #23)
> ...
> The cache stores the offset of the pointer SSA_NAME at its definition.  Since
> the SSA_NAME never changes, the context doesn't matter.  Or am I missing
> something?

Consider

  ptr_1 = &a + _2;
  if (_2 == 0)
    use1 (ptr_1);
  use2 (ptr_1);

if we visit use1 and ask ptr-query for ptr_1 with context 'use1' I
expect it to record offset 0 (_2 == 0) from &a at the ptr_1 definition
in the cache.  When we then proceed to use2 and ask ptr-query for ptr_1
with context 'use2' it will find the cached &a + 0, won't it?  And
that would be wrong here.

But as said I only briefly looked at how things work but it does
seem that the ability to specify a context to ptr_query but caching
things for SSA definitions with query results which use those context
can lead to wrong answers down the road.

Reply via email to