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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Chung-Kil Hur from comment #13)
> Hi, I have the following modified code.
> 
> #include <stdio.h>
> #include <stdint.h>
> #include <limits.h>
> 
> int main() {
>   int x = 0, *p = 0;
>   uintptr_t i;
>   uintptr_t j = (uintptr_t) &x;
>   uintptr_t k = j+j;
>   uintptr_t l = 2*j - j - j;
>   for (i = j+j-k+l; ; i++) {
>     if (i == (uintptr_t)&x) { p = (int*)i; break; }
>   }
>   *p = 15;
> 
>   printf("%d\n", x);
> }
> 
> This example still prints out "0" instead of "15".
> In this example, it seems that the integer "j+j-k+l" has no provenance.
> It is unclear to me how the provenance is calculated.
> Is there any concrete rule for calculating provenance?

early PTA computes

p_13, points-to non-local, points-to vars: { D.2349 }

  p_13 = (intD.6 *) i_1;
  *p_13 = 15;
  x.1_15 = xD.2349;

while late PTA has an IL with just the equivalency (the rest is optimized
away)

p_6, points-to non-local, points-to NULL, points-to vars: { }

  j_4 = (uintptr_t) &x;

  <bb 3>:
  # i_1 = PHI <0(2), i_5(5)>
  if (i_1 == j_4)
    goto <bb 4>;
  else
    goto <bb 5>;

  <bb 4>:
  p_6 = (int *) i_1;
  *p_6 = 15;
  x.1_8 = x;

so it hits essentially the same issue (the testcase is equivalent to the
original one).

Reply via email to