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

--- Comment #4 from cesar at gcc dot gnu.org ---
Created attachment 38122
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38122&action=edit
c test case

This test cases is failing for a couple of reasons. First, the reduction
variable doesn't have a data clause associated with it. Usually that isn't a
problem, like it would be in c with stack-based storage, but fortran uses
static allocation by default for local variables. Consequently, that static
reduction variable resides in a different lto partition from the offloaded
function. And that causes assertion failure in input_varpool_node. 

I'm not sure if we should create a static copy of that variable on the
accelerator. My inclination would be to teach the gimplifier to add an
present_or_copy clause for each reduction variable listed in a parallel
directive. The OpenACC spec is vague on what it means by "original variable",
but one could argue that it's the variable that resides on the host.

The c test case reproduces the fortran problem in c using a static int
reduction variable. A global reduction variable that is not associated with any
data clauses will also fail in a similar fashion.

Reply via email to