[Patch] OpenMP: Fixes for omp critical + hint

Thomas Schwinge thomas@codesourcery.com
Wed Jul 22 09:09:06 GMT 2020


Hi Tobias!

On 2020-07-21T17:43:00+0200, Tobias Burnus <tobias@codesourcery.com> wrote:
> On 7/21/20 2:18 PM, Jakub Jelinek wrote:
>> [...] shows that we don't really handle critical in such case
>> correctly, because nothing will then try to verify the value after
>> instantiation.
>
> In principle, the compiler is not required to diagnose all invalid code ...

Sure, but we should at least make an attempt to implement consistent
checking for reasonably similar cases that we know about requiring
separate/similar handling, such as non-templated vs. templated C++.

> In any case, I have now implemented it now also in pt.c.

Thanks.


> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/gomp/critical-hint-1.c
> @@ -0,0 +1,47 @@
> +#include <omp.h>

For build-tree testing, that'll pick up the *system* 'omp.h', thus:

    FAIL: c-c++-common/gomp/critical-hint-1.c (test for excess errors)
    Excess errors:
    [...]/c-c++-common/gomp/critical-hint-1.c:10:33: error: 'omp_sync_hint_none' undeclared (first use in this function); did you mean 'omp_lock_hint_none'?
    [...]

> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/gomp/critical-hint-2.c
> @@ -0,0 +1,36 @@
> +/* { dg-additional-options "-fdump-tree-original" } */
> +#include <omp.h>

Likewise.

> --- /dev/null
> +++ b/gcc/testsuite/gfortran.dg/gomp/critical-hint-1.f90
> @@ -0,0 +1,94 @@
> +subroutine example_criticial ()
> +  use omp_lib

Similar:

    FAIL: gfortran.dg/gomp/critical-hint-1.f90   -O  (test for excess errors)
    Excess errors:
    [...]/gfortran.dg/gomp/critical-hint-1.f90:2:7: Fatal Error: Cannot open module file 'omp_lib.mod' for reading at (1): No such file or directory

> --- /dev/null
> +++ b/gcc/testsuite/gfortran.dg/gomp/critical-hint-2.f90
> @@ -0,0 +1,65 @@
> +! { dg-additional-options "-fdump-tree-original" }
> +subroutine example_criticial ()
> +  use omp_lib

Likewise.

So I suppose you'll either have to put these testcases into 'libgomp', or
we'll have to invent something else?  Jakub, is there a reason why for
build-tree testing we can't just add '-I[build-tree]/libgomp' etc. in
'gcc.dg/gomp/gomp.exp' etc.?


Grüße
 Thomas

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter


More information about the Gcc-patches mailing list