[CRITICAL] IFort wrongly treating variable name as directive part

[CRITICAL] IFort wrongly treating variable name as directive part

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

 

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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)

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".

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today