[all-commits] [llvm/llvm-project] e1110d: [Flang][OpenMP][Sema] Add OpenMP warning when mapp...

agozillon via All-commits all-commits at lists.llvm.org
Wed Jun 10 01:14:58 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e1110dabc49d10c9353d6af7555c56f55fb0cca8
      https://github.com/llvm/llvm-project/commit/e1110dabc49d10c9353d6af7555c56f55fb0cca8
  Author: agozillon <Andrew.Gozillon at amd.com>
  Date:   2026-06-10 (Wed, 10 Jun 2026)

  Changed paths:
    M flang/include/flang/Semantics/openmp-utils.h
    M flang/lib/Semantics/check-omp-structure.cpp
    M flang/lib/Semantics/check-omp-structure.h
    M flang/lib/Semantics/openmp-utils.cpp
    A flang/test/Semantics/OpenMP/target-enter-data-temp-descriptor-omp61.f90
    A flang/test/Semantics/OpenMP/target-enter-data-temp-descriptor.f90

  Log Message:
  -----------
  [Flang][OpenMP][Sema] Add OpenMP warning when mapping local descriptors to device on enter without a corresponding exit (#201060)

This PR aims to add a new warning to Flang that will emit when a user
tries to map a local/temporary descriptor to device on an enter
directive without also applying it to a corresponding exit directive.
This problem can cause some pretty unique and difficult to track down
errors in programs as it can result in a user unintentionally locking
into place a stack allocated descriptor that has fallen out of scope,
which can result in a later clash with another stack allocated variable
that's being mapped and just happens to reside in the old descriptor
address range.

So this PR attempts to warn about this problem to prevent users doing
so, it's of note that we handle some of these cases in our
MapInfoFinalization pass, but I believe we should still include these
cases for portability reasons and incase we ever backtrack on our
decision to silently support some of these cases.

Made this warning as it was a suggestion from Michael Klemm and seemed
like a good PR to add to guide users to avoid this pattern (as it
unfortunately seems to be a common one that pops up). I'll perhaps look
into an optimization pass that tries to resolve some of these cases
silently in the future, but this will have to do in the meantime.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list