Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29252 Discussions

[CRITICAL] IFort wrongly treating variable name as directive part

Grund__Aalexander
516 Views

If you compile the following code with ifort -openmp the compiler will detect the variable wrongly as a "map(to" directive and complain about an unknown variable.

Similar in the omp update statement it wrongly complains about an unexpected "TO"

program fortTest
  integer top_value
  
  top_value = 0
  
  !$omp target data map(top_value)

  top_value = 1
  
  !$omp target update from(top_value)
  
  !$omp end target data
end

 

0 Kudos
3 Replies
Kevin_D_Intel
Employee
516 Views

This is an unfortunate defect that I reported to Development for repair (see internal tracking id below). As you noted, the compiler misinterprets any variable beginning with the string “to” when appearing before map and update from.

To work around this, you may change the variable to not begin with “to”, so you might use something like: t0p_value

Another work around to preserve the use of the variable “top_value” when using map is to add the clause tofrom: (equivalent to the default used map-type is unspecified) as in:

  !$omp target data map(tofrom:  top_value)

Unfortunately for update from, the only work around I could find was to add another variable between the “from(“ and the variable beginning with the string “to”, as in:

  !$omp target update from (t1, top_value)

I hope either of those workarounds will enable you to move forward and thank you for making us aware of this defect.

(Internal tracking id: DPD200255241)

0 Kudos
Grund__Aalexander
516 Views

Please note, that this also applies to any other keywords that are prefixes of variable names

program fortTest
  integer top_value
  integer from_value
  
  top_value = 0
  
  !$omp target data map(top_value) map(from_value)

  top_value = 1
  
  !$omp target update from(top_value)
  !$omp target update to(from_value)
  
  !$omp end target data
end

So the same happens to "from_value".

0 Kudos
Kevin_D_Intel
Employee
516 Views

Ok, I added that to the report. It also occurs with other !$omp target directive form also. Thank you for the additional note.

0 Kudos
Reply