On Tue, Feb 15, 2022 at 11:26:12AM +0100, Tobias Burnus wrote: > As found by Marcel, the 'depend' clause was differently handled in > 'omp depobj(...) depend(...)' and in 'omp task depend(...)'. > > The problem was that for a scalar pointer, depobj depended > on the pointer address - while task depended on the pointer-target address. > > If one now combines depobj and direct var dependency, the dependency > is on different addresses, such that the dependency is not honored. > Marcel's example is testsuite/libgomp.fortran/depend-4.f90. > (Thanks for the report!) > > > I think in the real world, the problem is not that big as most > code either uses depobj or a variable and does not mix them. Likewise, > using the address of a temporary variable (cf. below) will also usually > work in terms of dependency. > > > The attached patch does: > - depend clause (as used by task etc): > For scalar allocatable/pointer, add another dereference > > - For depobj (which handles the depend clause by itself) > - Fix array(element) handling by coping the depend-clause. > Before the result was 'D.123 = var; depobj = &D.123;' > which is really not intended. > - Several issues related to optional and allocatable/pointer. > > OK for mainline? Does backporting to GCC 11 make sense?
Ok. Dunno about backporting, perhaps later. Jakub