Go to file
Jakub Jelinek 2d20f69092 OpenMP/C++: Fix (first)private clause with member variables [PR110347]
OpenMP permits '(first)private' for C++ member variables, which GCC handles
by tagging those by DECL_OMP_PRIVATIZED_MEMBER, adding a temporary VAR_DECL
and DECL_VALUE_EXPR pointing to the 'this->member_var' in the C++ front end.

The idea is that in omp-low.cc, the DECL_VALUE_EXPR is used before the
region (for 'firstprivate'; ignored for 'private') while in the region,
the DECL itself is used.

In gimplify, the value expansion is suppressed and deferred if the
  lang_hooks.decls.omp_disregard_value_expr (decl, shared)
returns true - which is never the case if 'shared' is true. In OpenMP 4.5,
only 'map' and 'use_device_ptr' was permitted for the 'target' directive.
And when OpenMP 5.0's 'private'/'firstprivate' clauses was added, the
the update that now 'shared' argument could be false was missed. The
respective check has now been added.

2024-03-01  Jakub Jelinek  <jakub@redhat.com>
	    Tobias Burnus  <tburnus@baylibre.com>

	PR c++/110347

gcc/ChangeLog:

	* gimplify.cc (omp_notice_variable): Fix 'shared' arg to
	lang_hooks.decls.omp_disregard_value_expr for
	(first)private in target regions.

libgomp/ChangeLog:

	* testsuite/libgomp.c++/target-lambda-3.C: Moved from
	gcc/testsuite/g++.dg/gomp/ and fixed is-mapped handling.
	* testsuite/libgomp.c++/target-lambda-1.C: Modify to also
	also work without offloading.
	* testsuite/libgomp.c++/firstprivate-1.C: New test.
	* testsuite/libgomp.c++/firstprivate-2.C: New test.
	* testsuite/libgomp.c++/private-1.C: New test.
	* testsuite/libgomp.c++/private-2.C: New test.
	* testsuite/libgomp.c++/target-lambda-4.C: New test.
	* testsuite/libgomp.c++/use_device_ptr-1.C: New test.

gcc/testsuite/ChangeLog:

	* g++.dg/gomp/target-lambda-1.C: Moved to become a
	run-time test under testsuite/libgomp.c++.

Co-authored-by: Tobias Burnus <tburnus@baylibre.com>
(cherry picked from commit 4f82d5a95a)
2024-03-04 12:55:27 +01:00
INSTALL
c++tools Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
config Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
contrib Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
fixincludes Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
gcc OpenMP/C++: Fix (first)private clause with member variables [PR110347] 2024-03-04 12:55:27 +01:00
gnattools Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
gotools Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
include [og13] OpenMP: Call cuMemcpy2D/cuMemcpy3D for nvptx for omp_target_memcpy_rect 2023-09-20 11:18:51 +00:00
intl Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libada Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libatomic Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libbacktrace Daily bump. 2023-08-04 00:19:47 +00:00
libcc1 Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libcody Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libcpp Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libdecnumber Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libffi Merge branch 'releases/gcc-13' into devel/omp/gcc-13 2023-07-27 12:33:47 +02:00
libgcc Merge branch 'releases/gcc-13' into devel/omp/gcc-13 2023-10-26 11:19:57 +02:00
libgfortran OpenMP: requires unified_shared_memory patch, insert USM allocators into libgfortran 2023-08-21 07:47:29 -07:00
libgm2 Daily bump. 2023-09-14 00:24:51 +00:00
libgo compiler, libgo: support bootstrapping gc compiler 2023-06-23 16:15:56 -07:00
libgomp OpenMP/C++: Fix (first)private clause with member variables [PR110347] 2024-03-04 12:55:27 +01:00
libiberty Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libitm Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libobjc Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libphobos Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libquadmath Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libsanitizer Daily bump. 2023-08-08 00:20:39 +00:00
libssp Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
libstdc++-v3 Daily bump. 2023-10-26 00:20:46 +00:00
libvtv Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
lto-plugin Merge branch 'releases/gcc-13' into devel/omp/gcc-13 2023-07-27 12:33:47 +02:00
maintainer-scripts Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
zlib Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
ChangeLog.jit
ChangeLog.omp
ChangeLog.tree-ssa
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
README
ar-lib
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
depcomp
install-sh
libtool-ldflags
libtool.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
symlink-tree
test-driver
ylwrap

README

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.