Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flang sometimes fails to compile gfortran test is_iostat_end_eor_1 on AArch64 buildbots #63263

Closed
DavidSpickett opened this issue Jun 12, 2023 · 4 comments
Labels
cmake Build system in general and CMake in particular flang Flang issues not falling into any other category

Comments

@DavidSpickett
Copy link
Collaborator

In the following builds, https://github.com/llvm/llvm-test-suite/blob/main/Fortran/gfortran/regression/is_iostat_end_eor_1.f90 fails to compile with this error:

error: Semantic errors in /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/test/test-suite/Fortran/gfortran/regression/is_iostat_end_eor_1.f90
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/test/test-suite/Fortran/gfortran/regression/is_iostat_end_eor_1.f90:7:28: error: No explicit type declared for 'iostat_end'
    if ((.not. is_iostat_end(IOSTAT_END)) .or. is_iostat_end(0)) STOP 1
                             ^^^^^^^^^^
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/test/test-suite/Fortran/gfortran/regression/is_iostat_end_eor_1.f90:8:28: error: No explicit type declared for 'iostat_eor'
    if ((.not. is_iostat_eor(IOSTAT_EOR)) .or. is_iostat_end(0)) STOP 2

Selection of examples:
https://lab.llvm.org/buildbot/#/builders/179/builds/6396
https://lab.llvm.org/buildbot/#/builders/179/builds/6262
https://lab.llvm.org/buildbot/#/builders/179/builds/6231
https://lab.llvm.org/buildbot/#/builders/184/builds/4299
https://lab.llvm.org/buildbot/#/builders/184/builds/4283
https://lab.llvm.org/buildbot/#/builders/197/builds/6532
https://lab.llvm.org/buildbot/#/builders/176/builds/2666

The failure happens intermittently across 1 and 2 stage bots, SVE and non-SVE, vector length agnostic and vector length specific.

In each build there is no obvious change that could have caused it.

@DavidSpickett DavidSpickett added flang Flang issues not falling into any other category backend:AArch64 labels Jun 12, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 12, 2023

@llvm/issue-subscribers-backend-aarch64

@DavidSpickett
Copy link
Collaborator Author

@luporl Can you take a look please?

I am new to fortran so most importantly, is this error ever valid? I tried it with gfortran and it was fine: https://godbolt.org/z/bEfj8f8nz

@luporl
Copy link
Contributor

luporl commented Jun 12, 2023

The problem is that there is a conflict between these tests:

  • is_iostat_end_eor_1.f90
  • iso_fortran_env_1.f90

iso_fortran_env_1.f90 defines an iso_fortran_env module, that gets created in the current dir as iso_fortran_env.mod.
is_iostat_end_eor_1.f90 uses iso_fortran_env module, but it expects the standard one.
Thus, if is_iostat_end_eor_1.f90 is built before iso_fortran_env_1.f90, it gets the standard module and builds correctly, otherwise it gets the other test's module, fails to find iostat_end and iostat_eor in it, and the result is the error you reported.

Fortunately, patch https://reviews.llvm.org/D152307 already addresses it. It's already accepted and should land soon.
I've run the test-suite with it and can confirm it fixes this issue, by building each test on a separate dir.

tarunprabhu added a commit to llvm/llvm-test-suite that referenced this issue Jun 13, 2023
Use a dedicated module directory for each test. Any .mod files generated by the
test at build-time will be written into this directory. The same directory is
also used as the working directory for the the tests at test-time. Any files
created/read/written by the test at test-time reside in that directory. This
ensures that the tests don't race on the file system when run in parallel.

The tests that were previously disabled because of these races have been
re-enabled.

This fixes PR #63263 (llvm/llvm-project#63263)

Differential Revision: https://reviews.llvm.org/D152307
@DavidSpickett
Copy link
Collaborator Author

No failures seen since the patch landed.

@EugeneZelenko EugeneZelenko added cmake Build system in general and CMake in particular and removed backend:AArch64 labels Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular flang Flang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

4 participants