[all-commits] [llvm/llvm-project] 76d5d5: Avoid use of stack allocations in asynchronous calls

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Fri Feb 19 22:23:44 PST 2021


  Branch: refs/heads/release/12.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 76d5d54f62599d249e0bf2d1b0998451a584c3f3
      https://github.com/llvm/llvm-project/commit/76d5d54f62599d249e0bf2d1b0998451a584c3f3
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2021-02-19 (Fri, 19 Feb 2021)

  Changed paths:
    M openmp/libomptarget/include/omptarget.h
    M openmp/libomptarget/src/omptarget.cpp

  Log Message:
  -----------
  Avoid use of stack allocations in asynchronous calls

NOTE: This is an adaption of the original patch to be applicable to the
      LLVM 12 release branch. Logic is the same though.

As reported by Guilherme Valarini [0], we used to pass stack allocations
to calls that can nowadays be asynchronous. This is arguably a problem
and it will inevitably result in UB. To remedy the situation we allocate
the locations as part of the AsyncInfoTy object. The lifetime of that
object matches what we need for now. If the synchronization is not tied
to the AsyncInfoTy object anymore we might need to have a different
buffer construct in global space.

This should be back-ported to LLVM 12 but needs slight modifications as
it is based on refactoring patches we do not need to backport.

[0] https://lists.llvm.org/pipermail/openmp-dev/2021-February/003867.html

Differential Revision: https://reviews.llvm.org/D96667




More information about the All-commits mailing list