Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Incosistent #include paths of ifort and ifx

V-T
New Contributor I
5,397 Views
Consider the following directory tree:
test.F90
b.inc
test/
├─ a.inc
└─ b.inc

With the following contents:

  • `test.F90`:
#include "test/a.inc"
end
  • `test/a.inc`:
#include "test/b.inc"
#include "b.inc"
#include "b.inc"
  • `test/b.inc`:
print*,"Hello from test/b.inc"
  • `b.inc`:
print*,"Hello from b.inc"

A similar example was already discussed hereRunning the compiled code with the Intel compiler (ifort 2021.8.0 and ifx 2023.0.0 on Ubuntu 18.04.2 LTS) without any flags leads to the following output:

 Hello from test/b.inc
 Hello from test/b.inc
 Hello from test/b.inc

After the first `#include "test/b.inc"` in `a.inc` the directory is "changed" to `test` for some reason and only `test/b.inc` is included in all consequent `#include` statements.

Is it the intended behavior of the preprocessor? Or is it a bug?

Labels (1)
0 Kudos
1 Solution
Barbara_P_Intel
Employee
4,390 Views

This fpp issue is fixed in the compiler versions released this week as part of 2024.0.

@V-T, please try the new compiler.



View solution in original post

0 Kudos
21 Replies
V-T
New Contributor I
478 Views

@Barbara_P_Intel, it works now as intended, thank you!

0 Kudos
Reply