Issue 131088
Summary [flang] COMPLEX*32 works but COMPLEX(real128) - Open MPI build fails
Labels flang
Assignees
Reporter hakostra
    I encountered a problem building Open MPI 5.0.7 with a newly compiled `flang` from git sources, reported here: https://github.com/open-mpi/ompi/issues/13136

The version of `flang` I built is:

```
flang version 21.0.0git (https://github.com/llvm/llvm-project.git 5d50af3f0368847ab9ce1d86cb6e46ffaf317b59)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm/llvm-project/install/bin
```

The problem is in short that variable declarations `COMPLEX(real128)` does not work, take the following as an example:

```
PROGRAM real128test
    USE iso_fortran_env, ONLY: real128
    IMPLICIT NONE (type, external)

    COMPLEX(real128) :: test

    test = CMPLX(1.0, 2.0)
    WRITE(*, *) "test: ", test
 WRITE(*, *) "storage_size: ", storage_size(test)
END PROGRAM real128test
```

Compiling this I get:

```
error: Semantic errors in real128.F90
./real128.F90:5:5: error: COMPLEX(KIND=-1) is not a supported type
      COMPLEX(real128) :: test
```

However, the similar example, using COMPLEX*32, works:

```
PROGRAM complextest
    IMPLICIT NONE (type, external)

    COMPLEX*32 test

    test = CMPLX(1.0, 2.0)
 WRITE(*, *) "test: ", test
    WRITE(*, *) "storage_size: ", storage_size(test)
END PROGRAM complextest
```

Giving me the output:

```
$ flang complex32.F90 
$ ./a.out 
 test:  (1.,2.)
 storage_size:  256
```

Which I think is a bit weird. In my mind, `COMPLEX*32` and `COMPLEX(real128)` should be the same type, but maybe I'm wrong...

So it seems my `flang` was compiled without support for `real128`, which is fine, I don't need it. However, I find it strange that `COMPLEX*32` works in this scenario. A side-note is that I have attempted to build `flang` wit OpenMP offloading support, maybe that is why `real128` is disabled.

So the reason the Open MPI build fails, is that it checks for the support of `COMPLEX*32` with some simple test, then, if this is support is present, it goes ahead and use `COMPLEX(real128)` as if these two declarations are equivalent. This does not work and the build fails.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to