[Rd] Is it intentional that the Fortran optimization flags changefrom O3 to O2 on Windows?

Avraham Adler avraham.adler at gmail.com
Mon Aug 8 17:24:55 CEST 2016

When compiling R-devel (2016-08-07) on Windows (64bit) using Rtools
(3.4.0), the C++ optimization flags are manually changed to -O2 from
-O3. This has been the situation for years, and I believe this is to
prevent certain optimizations which may cause downstream problems. In
R_HOME/src/gnuwin32/fixed/etc/Makeconf, this is seen by the -O2
entries in the CXXFLAGS and CXX1XFLAGS variables. The FFLAGS and
FCFLAGS entries in Makeconf still show -O3.

When looking at R_HOME/etc/x64/Makeconf, however, the entries for
FCFLAGS and FFLAGS are -O2. My hunch is that in
R_HOME/src/gnuwin32/fixed/Makefile, line 29 is changing ALL O3 to O2,
and not just those relating to C++:

  ifeq "$(WIN)" "64"
    $(SED) -e 's/WIN = 32/WIN = 64/' \
      -e "s/-O3/-O2/" \

Is this intentional? If not, is there a way to keep O3 optimization
with FORTRAN outside of quickly editing Makeconf before R's
compilation gets to using it?

Thank you,


More information about the R-devel mailing list