This patch looks for malloc/free calls that were generated by allocate statement that is associated with allocate directive and replaces them with GOMP_alloc and GOMP_free. gcc/ChangeLog: * omp-low.cc (scan_sharing_clauses): Handle OMP_CLAUSE_ALLOCATOR. (scan_omp_allocate): New. (scan_omp_1_stmt): Call it. (lower_omp_allocate): New function. (lower_omp_1): Call it. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/allocate-6.f90: Add tests. * gfortran.dg/gomp/allocate-7.f90: New test. * gfortran.dg/gomp/allocate-8.f90: New test. libgomp/ChangeLog: * testsuite/libgomp.fortran/allocate-2.f90: New test. --- gcc/omp-low.cc | 139 ++++++++++++++++++ gcc/testsuite/gfortran.dg/gomp/allocate-6.f90 | 9 ++ gcc/testsuite/gfortran.dg/gomp/allocate-7.f90 | 13 ++ gcc/testsuite/gfortran.dg/gomp/allocate-8.f90 | 15 ++ .../testsuite/libgomp.fortran/allocate-2.f90 | 48 ++++++ 5 files changed, 224 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/gomp/allocate-7.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/allocate-8.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/allocate-2.f90