llvm / llvm/llvm-project

[flang][OpenMP] DEFAULTMAP(none:aggregate) crashes in OmpAttributeVisitor

Open
#218,929 1 comment 0 reactions 1 assignee Claimed by @chandraghale View on GitHub
crash flang:frontend flang:openmp
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

## Reproducer

Compiler Explorer: https://godbolt.org/z/zbjTs7na4

```fortran
program p
type t
end type
type(t) :: x

!$omp target defaultmap(none:aggregate)
x = t()
!$omp end target
end
```

Compile with:

```console
flang -fopenmp -c repro.f90
```

## Actual result

Flang crashes during OpenMP semantic processing:

```text
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/
Stack dump:
...
Fortran::semantics::IsOpenMPAggregate(...)
Fortran::semantics::OmpAttributeVisitor::Post(...)
...
flang-24: error: unable to execute command: Segmentation fault (core dumped)
```

The original llvm-test-suite case,
[`Fortran/gfortran/regression/gomp/defaultmap-3.f90`](https://github.com/llvm/llvm-test-suite/blob/3c0a28f12509091808c051c80ca867d9085cd8fb/Fortran/gfortran/regression/gomp/defaultmap-3.f90),
crashes in the same path.

## Expected result

The source should compile, or Flang should emit a normal diagnostic if the construct is unsupported, rather than crashing.

## Environment

```text
flang version 24.0.0git
llvm-project commit b0dc60f01ab0057eea54ce82ab5498118a60567c
Target: x86_64-unknown-linux-gnu
LLVM_ENABLE_ASSERTIONS=ON
```

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.