I really appreciate your assistance, and the time you dedicated to building LLVM !
I noticed that you've posted the issue on GitHub, thanks for this too, I'll stay updated and regularly check the answers. Does a compiler bug imply that the issue doesn't come from from the code? Once again, thank you for your help! Romain ----- Mail original ----- De: "Ivan Krylov" <krylov.r...@gmail.com> À: "Romain Pierlot" <romain.pier...@u-bordeaux.fr> Cc: "r-package-devel" <r-package-devel@r-project.org> Envoyé: Mardi 31 Octobre 2023 17:58:05 Objet: Re: [R-pkg-devel] Issue with R Package on CRAN - OpenMP and clang17 В Mon, 30 Oct 2023 18:52:29 +0300 Ivan Krylov <krylov.r...@gmail.com> пишет: > I'll try to reproduce your problem, starting by downloading and > compiling flang from https://github.com/llvm/llvm-project.git commit > 092b6c5ee3707ea10b9f10d0a674e8d12395369b (as stated at > <https://www.stats.ox.ac.uk/pub/bdr/clang17/frailtypack.log>) Wow. Building LLVM is an adventure, and I don't mean it in a good way. I had to patch flang/include/flang/Semantics/symbol.h because it declares `friend class std::array` while my copy of the C++ standard library has a `struct std::array`, which makes the friend declaration an error. Naively thinking that I would be helping debug the problem, I tried compiling a debugging build of LLVM, only to watch in horror as it consumed all disk space I could offer it. I eventually ran out of things to delete after the build directory reached 100 gigabytes in size, while the build still had 1000 out of 6000 targets to compile and link. Even the release build failed at 410 remaining targets because of a missing -fPIC somewhere in the compiler command line. Thankfully, it still produced a working `flang-new` executable. A release build of LLVM + flang-new takes a relatively reasonable 8.2 GBytes of storage. The computers that helped launch the first people into space had 2 kWords of memory, but nowadays you need more than 256 MBytes of RAM to launch a bird into a pig and 10 GBytes of storage in order to compile a compiler. This is what progress looks like. I was able to reduce the example to the following program: program main implicit none real :: sum = 0 integer :: i, n = 10 sum = sum + 1. ! <-- error here if followed by OpenMP reduction !$OMP PARALLEL DO default(none) PRIVATE (i) SHARED(n) & !$OMP REDUCTION(+:sum) SCHEDULE(Dynamic,1) do i=1,n sum = sum + real(i) end do !$OMP END PARALLEL DO print *, sum end % flang-new -c -o /dev/null src.f90 -fopenmp error: loc("src.f90":7:5): 'omp.reduction' op must be used within an operation supporting reduction clause interface error: verification of lowering to FIR failed gfortran raises no errors or warnings for the test program. Bug reported at <https://github.com/llvm/llvm-project/issues/70828>. Would that be enough proof of a compiler bug, or do we need a confirmation from the developers? -- Best regards, Ivan -- [ https://www.u-bordeaux.fr/ ] [ http://www.aquitaine-poitou-charentes.inserm.fr/ ] [ mailto: | Romain Pierlot ] Ingénieur de recherches Bio-Informatique Équipe BIOSTAT [ https://www.u-bordeaux.fr/ | https://www.u-bordeaux.fr ] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel