Skip to content
Prev 9787 / 12125 Next

[R-pkg-devel] Issue with R Package on CRAN - OpenMP and clang17

? Mon, 30 Oct 2023 15:58:31 +0100 (CET)
Romain Pierlot <romain.pierlot at u-bordeaux.fr> ?????:
This is exactly the right place to ask. Welcome to R-package-devel!
I'm not 100% sure, but I currently think that this is a compiler bug.

You have a variable, ss, declared inside a function.

If nb_procs==1, you start an OpenMP parallel region with a reduction on
that variable. The OpenMP parallel region starts and ends inside that
if clause. Outside the parallel region, in another branch, you add to
it as usual.

Flang-new complains about your use of the 'ss' variable outside the
parallel region, alleging that it's not valid for an OpenMP reduction.
There is no OpenMP reduction in sight where the error is reported. I
think that Flang-new is wrong to signal an error here.

Unfortunately, proving that this is a compiler bug might be hard. 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>). I hope
it will be possible to simplify Integrale_mult_scl.f90 until it looks
manageable for their bug tracker.
These errors only happen with the "flang-new" Fortran compiler that's
part of the LLVM compiler infrastructure. You're probably using
gfortran or some other, more well-polished Fortran compiler.