https://gcc.gnu.org/g:47fa5cf9ec10bf3b82e211a1b67ab925f8af3178
commit 47fa5cf9ec10bf3b82e211a1b67ab925f8af3178 Author: Thomas Schwinge <tschwi...@baylibre.com> Date: Wed Jul 3 22:09:39 2024 +0200 Fortran/OpenMP: Support mapping of DT with allocatable components: disable 'generate_callback_wrapper' for nvptx target This is, obviously, not the final fix for this issue. gcc/fortran/ * class.cc (generate_callback_wrapper) [GCC_NVPTX_H]: Disable. Diff: --- gcc/fortran/ChangeLog.omp | 4 ++++ gcc/fortran/class.cc | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp index 65b918f4ed76..917fad1de90a 100644 --- a/gcc/fortran/ChangeLog.omp +++ b/gcc/fortran/ChangeLog.omp @@ -1,3 +1,7 @@ +2024-07-03 Thomas Schwinge <tschwi...@baylibre.com> + + * class.cc (generate_callback_wrapper) [GCC_NVPTX_H]: Disable. + 2024-05-15 Jakub Jelinek <ja...@redhat.com> * openmp.cc (resolve_omp_clauses): Diagnose grainsize diff --git a/gcc/fortran/class.cc b/gcc/fortran/class.cc index 15aacd98fd8a..2c062204e5a4 100644 --- a/gcc/fortran/class.cc +++ b/gcc/fortran/class.cc @@ -64,6 +64,7 @@ along with GCC; see the file COPYING3. If not see #include "gfortran.h" #include "constructor.h" #include "target-memory.h" +#include "tm.h" //TODO /* Inserts a derived type component reference in a data reference chain. TS: base type of the ref chain so far, in which we will pick the component @@ -2420,6 +2421,30 @@ generate_callback_wrapper (gfc_symbol *vtab, gfc_symbol *derived, gfc_namespace *ns, const char *tname, gfc_component *vtab_cb) { + //TODO +#ifdef GCC_NVPTX_H + /* Code generated here appears not relevant for nvptx target (completely + unused?), but results in erroneous PTX code generated: + + ptxas /tmp/ccAMr7D9.o, line 63; error : Illegal operand type to instruction 'st' + ptxas /tmp/ccAMr7D9.o, line 63; error : Unknown symbol '%stack' + ptxas fatal : Ptx assembly aborted due to errors + nvptx-as: ptxas returned 255 exit status + compiler exited with status 1 + + Note that also outside of OG14 (that is, in GCC 14 as well as GCC trunk), + we have a number of instances of this 'ptxas' error, all over the Fortran + test suite (only). The current theory therefore is that there is some + latent issue, which is just greatly exacerbated by this code here. + + This could be the Fortran front end generating incorrect GIMPLE, or the + middle end or (more likely?) nvptx back end not correctly handling + something that only comes into existance via the Fortran front end. + + Until that is resolved, just skip this. */ + return; +#endif + gfc_namespace *sub_ns; gfc_code *last_code, *block; gfc_symbol *callback, *cb, *token, *this_ptr, *scalar, *flag, *result;