Skip to content

Bugfix/intel fpp fix#1392

Open
jim-p-w wants to merge 1 commit intoMPAS-Dev:developfrom
jim-p-w:bugfix/intel-fpp-fix
Open

Bugfix/intel fpp fix#1392
jim-p-w wants to merge 1 commit intoMPAS-Dev:developfrom
jim-p-w:bugfix/intel-fpp-fix

Conversation

@jim-p-w
Copy link
Contributor

@jim-p-w jim-p-w commented Jan 7, 2026

This PR addresses a problem with the intel fortran preprocessor (fpp).

In particular, the default preprocessor ordering results in a failure to expand a macro properly when it is used as an argument to another macro.
Given the following definitions:

#define COMMA ,
#define STREAM_DEBUG_WRITE(M) call mpas_log_write(M)

followed by the following invocation:

STREAM_DEBUG_WRITE(' -- Setting record to: $i' COMMA intArgs=(/stream % nRecords/))

results in the COMMA and everything after it being eliminated from the final expansion:

call mpas_log_write(' -- Setting record to: $i')

There is a switch you can provide to fpp (via the compiler) which changes the order of nexted macro expansion and gives the desire result.

I tested this by running test_model and verifying correct printouts, using both an intel make build and an intl cmake build.

@jim-p-w jim-p-w marked this pull request as ready for review January 7, 2026 22:11
@pb475
Copy link

pb475 commented Jan 9, 2026

Can confirm, experienced the same issue with intel oneapi compiler.

My hack of a fix was to edit the lined using the COMMA expansion, but yours is a much better fix.

I grabbed your fix and re-compiled and ran a quick test run on my machine too. All looks good.

@mgduda mgduda self-requested a review January 9, 2026 18:26
@mgduda mgduda added bug fix Build System Changes related to the build system, either `Make` or `CMake`. labels Jan 9, 2026
@fmahebert
Copy link

fmahebert commented Jan 15, 2026

This PR fixes my build using intel 2025.3, as reported in #1397

Copy link
Contributor

@mgduda mgduda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

@pb475 @fmahebert Thanks for your feedback on this PR!

@mgduda
Copy link
Contributor

mgduda commented Feb 6, 2026

@jim-p-w Before we merge this, could you modify the commit history so that your two commits have unique one-line summaries? Currently, running git log --oneline on the PR branch shows:

f476e1c63 Change the intel fortran preprocessing order.
d5b1f7d28 Change the intel fortran preprocessing order.

This fixes a problem when using a macro in the invocation of another macro.
This change is only for using the intel build tools.
It applies to both gnu make builds and cmake builds.
@jim-p-w jim-p-w force-pushed the bugfix/intel-fpp-fix branch from f476e1c to f18ccf0 Compare February 7, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Build System Changes related to the build system, either `Make` or `CMake`.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants