flang-compiler / flang

Flang is a Fortran language front-end designed for integration with LLVM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: variable 'ili' is used uninitialized whenever 'if' condition is false

dmikushin opened this issue · comments

clang-16 is saying "You shall not pass" here:

classic-flang                 | /classic-flang/src/classic-flang/tools/flang2/flang2exe/expsmp.cpp:2687:8: error: variable 'ili' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
classic-flang                 |     if(opc == IM_ETARGETDATA) {
classic-flang                 |        ^~~~~~~~~~~~~~~~~~~~~
classic-flang                 | /classic-flang/src/classic-flang/tools/flang2/flang2exe/expsmp.cpp:2692:15: note: uninitialized use occurs here
classic-flang                 |     chk_block(ili);
classic-flang                 |               ^~~

Thanks for reporting this. We fixed a bunch of -Wsometimes-uninitialized warnings under tools/flang2/ in 319e967, but this one had escaped because the OMP_OFFLOAD_LLVM macro is unsupported, and we don't build with it defined.

I've followed the building guide

To build flang with OpenMP target offload support (LLVM 7.0 and higher), add -DFLANG_OPENMP_GPU_NVIDIA=ON

and I think it enabled this code. Is it supported or not?

There was some support for OpenMP target offload. But this has not been maintained in classic flang and defended with tests. Downstream commercial compilers might have this working.

@kiranchandramohan what commerical compilers based on this code are currently in the use?

From the Readme:
Classic Flang is used in several downstream commercial projects like the AMD, Arm and Huawei compilers, ...

The Arm compiler does not have offloading support. FWIU, there is support in AOCC and Bisheng. But I am not sure whether it is based on this code or a completely new code.

Since Classic Flang was derived from pgfortran/nvfortran, there is support in nvfortran . But I am not sure whether it is based on this code or a completely new code.

Correction: BiSheng has kept offloading disabled at the moment. Only AOCC and nvfortran support offloading.

From what I understand, over the past few years Huawei is the only company upstreaming their changes to this repository. Did AMD or Arm ever upstream any recent contribution here, or to any other public repository that you know of?

This issue has been fixed by #1389