https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90030

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Chung-Lin Tang <clt...@gcc.gnu.org>:

https://gcc.gnu.org/g:1ac7a8c9e4798d352eb8c64905dd38086af4e1cd

commit r12-5706-g1ac7a8c9e4798d352eb8c64905dd38086af4e1cd
Author: Chung-Lin Tang <clt...@codesourcery.com>
Date:   Thu Dec 2 18:24:03 2021 +0800

    fortran: OpenMP/OpenACC array mapping alignment fix (PR90030)

    Fix issue with the Fortran front-end when mapping arrays: when creating the
    data MEM_REF for the map clause, there was a convention of casting the
    referencing pointer to 'c_char *' by
    fold_convert (build_pointer_type (char_type_node), ptr).

    This causes the alignment passed to the libgomp runtime for array data
    hardwared to '1', and causes alignment errors on the offload target.

    This patch fixes this by removing the char_type_node pointer converts, and
    adding gcc_asserts to ensure POINTER_TYPE_P (TREE_TYPE (ptr)).

            PR fortran/90030

    gcc/fortran/ChangeLog:

            * trans-openmp.c (gfc_omp_finish_clause): Remove fold_convert to
pointer
            to char_type_node, add gcc_assert of POINTER_TYPE_P.
            (gfc_trans_omp_array_section): Likewise.
            (gfc_trans_omp_clauses): Likewise.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/goacc/finalize-1.f: Adjust scan test.
            * gfortran.dg/gomp/affinity-clause-1.f90: Likewise.
            * gfortran.dg/gomp/affinity-clause-5.f90: Likewise.
            * gfortran.dg/gomp/defaultmap-4.f90: Likewise.
            * gfortran.dg/gomp/defaultmap-5.f90: Likewise.
            * gfortran.dg/gomp/defaultmap-6.f90: Likewise.
            * gfortran.dg/gomp/map-3.f90: Likewise.
            * gfortran.dg/gomp/pr78260-2.f90: Likewise.
            * gfortran.dg/gomp/pr78260-3.f90: Likewise.

    libgomp/ChangeLog:

            * testsuite/libgomp.oacc-fortran/pr90030.f90: New test.
            * testsuite/libgomp.fortran/pr90030.f90: New test.

Reply via email to