]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP/C++: Fix declare_variant's 'adjust_args' if there is a 'this' pointer [PR118321]
authorTobias Burnus <tburnus@baylibre.com>
Fri, 17 Jan 2025 13:25:18 +0000 (14:25 +0100)
committerTobias Burnus <tburnus@baylibre.com>
Fri, 17 Jan 2025 13:25:18 +0000 (14:25 +0100)
commit5e91be6f8ce978e1d30c8a958072545002168ed1
tree1432b7582c2799d02ebd2a34f8cd7f2ffdb2b138
parentf3ccc57e5f044031a1b07e79330de9220e93afe7
OpenMP/C++: Fix declare_variant's 'adjust_args' if there is a 'this' pointer [PR118321]

The adjust_args clause is internally store as the i-th argument to the function,
which fails if hidden arguments come before. This commit handles the C++ 'this'
pointer by shifting the internal arg index by one.

PR fortran/118321

gcc/cp/ChangeLog:

* decl.cc (omp_declare_variant_finalize_one): Shift adjust_args index
by one for non-static class function's 'this' pointer.

gcc/testsuite/ChangeLog:

* g++.dg/gomp/adjust-args-4.C: New test.
gcc/cp/decl.cc
gcc/testsuite/g++.dg/gomp/adjust-args-4.C [new file with mode: 0644]