llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.59k stars 11.81k forks source link

[flang][OpenMP] assertion failure for copying of common variables #112538

Open tblah opened 3 days ago

tblah commented 3 days ago

flang -fopenmp currently hits an assertion failure building this program: https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0070/0070_0185.f03

llvm-project/flang/include/flang/Optimizer/Builder/BoxValue.h:375: fir::MutableBoxValue::MutableBoxValue(mlir::Value, mlir::ValueRange, MutableProperties): Assertion `verify() && "MutableBoxValue requires mem ref to fir.box<fir.[heap|ptr]<type>>"` failed.

There are two problems here

  1. We should add a semantic check similar to https://github.com/llvm/llvm-project/pull/110671 which prevents namelist variables in copyin. This is already not allowed in private and reduction and it was concluded in the above PR that even if the standard allows this we should not support it because it would be difficult to do without introducing performance regressions
  2. The assertion failure (reproducible with the name-list removed)
llvmbot commented 3 days ago

@llvm/issue-subscribers-flang-ir

Author: Tom Eccles (tblah)

`flang -fopenmp` currently hits an assertion failure building this program: https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0070/0070_0185.f03 ``` llvm-project/flang/include/flang/Optimizer/Builder/BoxValue.h:375: fir::MutableBoxValue::MutableBoxValue(mlir::Value, mlir::ValueRange, MutableProperties): Assertion `verify() && "MutableBoxValue requires mem ref to fir.box<fir.[heap|ptr]<type>>"` failed. ``` There are two problems here 1. We should add a semantic check similar to https://github.com/llvm/llvm-project/pull/110671 which prevents namelist variables in copyin. This is already not allowed in private and reduction and it was concluded in the above PR that even if the standard allows this we should not support it because it would be difficult to do without introducing performance regressions 2. The assertion failure (reproducible with the name-list removed)