[all-commits] [llvm/llvm-project] 8619a5: [flang][OpenMP] Avoid marking named main programs ...

Sairudra More via All-commits all-commits at lists.llvm.org
Mon Apr 13 22:13:14 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8619a5efd84b10b9cb4ea33449c38fa6390f9baa
      https://github.com/llvm/llvm-project/commit/8619a5efd84b10b9cb4ea33449c38fa6390f9baa
  Author: Sairudra More <sairudra60 at gmail.com>
  Date:   2026-04-14 (Tue, 14 Apr 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    A flang/test/Lower/OpenMP/declare-target-named-main-interface.f90
    M flang/test/Lower/OpenMP/real10.f90

  Log Message:
  -----------
  [flang][OpenMP] Avoid marking named main programs as declare target (#190250)

A bare `!$omp declare target` could incorrectly mark `_QQmain` as
`omp.declare_target` when it appeared in an interface body inside a
named
main program. That pulled host-only callees into device compilation and
caused offload link failures.

Fix this by skipping main programs in the implicit-capture path.
Also add a regression test for the named-main interface case and update
`real10.f90` to use a valid container for the bare `declare target`
form.

This fixes offload link failures where `_QQmain` was incorrectly treated
as
a device function and pulled in host-only symbols such as Fortran I/O
runtime calls.

Minimal reproducer:

```fortran
program named_main
  interface
    subroutine sub_a(x)
      !$omp declare target
      integer, intent(inout) :: x
    end subroutine
  end interface
  integer :: v
  !$omp target
    call sub_a(v)
  !$omp end target
end program



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