llvm / llvm/llvm-project

[flang][OpenMP] Whole-COMMON map with member use_device_addr fails LLVM IR translation

Open
#217,112 0 comments 0 reactions 1 assignee Claimed by @Saieiei View on GitHub
flang:openmp
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Flang fails during LLVM IR translation when a whole named COMMON block is mapped on `target data` while its individual members appear in `use_device_addr`.

Reproducer

```fortran
subroutine test
integer :: x, y
common /cb/ x, y

!$omp target data map(tofrom: /cb/) use_device_addr(x, y)
x = y + 1
!$omp end target data
end
```

```console
flang -fc1 -emit-llvm -fopenmp -fopenmp-version=50 test.f90 -o -
```

Actual behavior
The frontend accepts the construct, but LLVM IR translation fails with:

```text
store i32 %2,
error: failed to create the LLVM module
```

Expected behavior
Flang should produce valid LLVM IR, with `x` and `y` in the region using their corresponding device addresses.

This appears to be caused by the whole-COMMON `map` using an aggregate operand while `use_device_addr` uses member-level operands for the same storage.

This is a pre-existing issue and is not addressed by #217105.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.