This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/68640] foo restrict propagated to foo._omp_fn.0


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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Is it used because it ends up in the static chain of the omp_fn and uses the
same (original) qualifiers?  And the static chain itself is passed "by
reference"
and thus gets its fields looked at and restrict extracted.

int
foo (int *__restrict__ ap)
{
  int *bp = ap;
#pragma omp parallel for
  for (unsigned int idx = 0; idx < N; idx++)
    ap[idx] = bp[idx];
}

I believe this testcase is invalid as you access *ap through bp which is
not based on ap.

But your point is that "based on" is not properly passed through the
OMP lowering which will split out the use into a separate function
thus violating the constraints we set for restrict in PTA (_only_
derive it from parameters because their scope is fixed).

This would mean you need to drop restrict qualifiers for any pointers
you "leak" to the static chain (in the static chain field-decls type).

Yes, if we fix visit_loadstore for

          /* ???  We need to make sure 'ptr' doesn't include any of
             the restrict tags we added bases for in its points-to set.  */
          return false;

you may be able to create a miscompile here (if you manage to create a
valid testcase in the first place)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]