stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

Intel ifx does not preprocess .F90 files by default

Open SteamPower101 opened this issue 8 months ago • 2 comments

Description

The default on Intel ifx is /nofpp with no exceptions for .F90 files.

https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2025-3/fpp.html

Expected Behaviour

.F90 files do no compile unless the /fpp flag is added.

Version of stdlib

master

Platform and Architecture

MSVS 2022, ifx 2025, Windows 11 x64

Additional Information

No response

SteamPower101 avatar Mar 11 '26 16:03 SteamPower101

I tried to build stdlib with IFX. Total failure not only of the above bug, but also not one of the *.mod files was created. Because stdlib_kinds was missing, tons and tons of errors were produced.

sylviankahane avatar Jun 28 '26 16:06 sylviankahane

@SteamPower101, @jvdp1,

I looked into this issue. On Windows, Intel compilers (ifx and ifort) default to /nofpp, which causes .F90 files with C-preprocessor directives to fail compilation. In config/DefaultFlags.cmake, CMAKE_Fortran_FLAGS_INIT for Intel is currently uninitialized.

To address this cleanly across all supported CMake versions

  1. In config/DefaultFlags.cmake: initialize CMAKE_Fortran_FLAGS_INIT to /fpp on Windows (WIN32) and -fpp on POSIX when CMAKE_Fortran_COMPILER_ID MATCHES "^Intel".
  2. In cmake/stdlib.cmake, test/CMakeLists.txt, and example/CMakeLists.txt: ensure configure_stdlib_target, ADDTESTPP, and ADD_EXAMPLEPP pass /fpp / -fpp so targets compiling .F90 sources always preprocess properly.

I have tested this fix end-to-end locally with CMake 3.14 (all 433 tests passing). If this approach looks good to the maintainers, I would be happy to open a PR.

chaitanya-bhardwaj avatar Oct 11 '26 21:10 chaitanya-bhardwaj