[Patch][OpenMP][Fortran] Support absent optional args with use_device_{ptr,addr} (+ OpenACC's use_device clause)

Tobias Burnus tobias@codesourcery.com
Fri Nov 8 15:42:00 GMT 2019


Hi Jakub,

thanks for the review.

On 11/8/19 3:39 PM, Jakub Jelinek wrote:
>> +      /* Walk function argument list to find the hidden arg.  */
>> +      decl = DECL_ARGUMENTS (DECL_CONTEXT (decl));
>> +      for ( ; decl != NULL_TREE; decl = TREE_CHAIN (decl))
>> +	if (DECL_NAME (decl) == tree_name)
>> +	  break;
> Is this reliable?  I mean, consider -fallow-leading-underscore with:
> subroutine foo (a, _a)

I also assume that this will break; unlikely in real-world code but still.

> Not really sure if additional DECL_ARTIFICIAL (decl) test would be enough.

At least, I cannot quickly come up with a case where it will break. – I 
have now added it; also to the existing trans-expr.c function – which 
uses the used and, hence, same algorithm.

>> +omp_check_optional_argument (tree decl, bool also_value)
> Why is the argument called for_present_check in the langhook and
> also_value here?  Looks inconsistent.

Because I initially was thinking only of the VALUE attribute until I 
realized that assumed-shape arrays have the same issue; they use a local 
variable for the data – and make the actual array descriptor available 
via lang-specific field. – As the use is either an extra deref is needed 
or a check whether the variable is present, I changed the meaning – 
seemingly, three places survived with the old name.

With DECL_ARTIFICIAL added and also_value replaced:
Build on x86-64-gnu-linux. OK once regtested?

Tobias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: absent-v3.diff
Type: text/x-patch
Size: 24578 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191108/a5cfb4a8/attachment.bin>


More information about the Gcc-patches mailing list