[Patch] OpenMP: Fixes for omp critical + hint

Tobias Burnus tobias@codesourcery.com
Tue Jul 21 12:05:36 GMT 2020


On 7/21/20 1:25 PM, Jakub Jelinek via Fortran wrote:

>>   c_finish_omp_critical (location_t loc, tree body, tree name, tree clauses)
>>   {
>> +  gcc_assert (!clauses || OMP_CLAUSE_CODE (clauses) == OMP_CLAUSE_HINT);
>> +  if (name == NULL_TREE && clauses != NULL_TREE
>> +      && INTEGRAL_TYPE_P (TREE_TYPE (OMP_CLAUSE_HINT_EXPR (clauses)))
>> +      && tree_fits_shwi_p (OMP_CLAUSE_HINT_EXPR (clauses))
>> +      && tree_to_shwi (OMP_CLAUSE_HINT_EXPR (clauses)) != 0)
> Use
>    if (name == NULL_TREE
>        && clauses != NULL_TREE
>        && integer_nonzerop (OMP_CLAUSE_HINT_EXPR (clauses)))
> instead?

This code is both called by C and C++ – and for C++. And I would like
to permit "hint(N)" where N is a template parameter.

Hence, I added another:
   '&& TREE_CODE (OMP_CLAUSE_HINT_EXPR (clauses)) == INTEGER_CST'
to your proposal.

Thanks for your suggestions!

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omp-hint.diff
Type: text/x-patch
Size: 25068 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200721/91f77678/attachment.bin>


More information about the Gcc-patches mailing list