Skip to content

Fix GNU Debug build of fftpack5.1.f - #3437

Merged
andrew-platt merged 1 commit into
OpenFAST:devfrom
andrew-platt:b/fftpack51_compile_fails
Aug 20, 2026
Merged

Fix GNU Debug build of fftpack5.1.f#3437
andrew-platt merged 1 commit into
OpenFAST:devfrom
andrew-platt:b/fftpack51_compile_fails

Conversation

@andrew-platt

Copy link
Copy Markdown
Collaborator

Ready to merge

Feature or improvement description

Debug builds with gfortran fail to compile fftpack5.1.f with 64 hard errors:

  Error: Type mismatch in argument 'dsum' at (1); passed REAL(4) to REAL(8)
  Error: Type mismatch in argument 'c' at (1); passed REAL(4) to COMPLEX(4)

These mismatches are intentional: FFTPACK 5.1 uses legacy Fortran 77 type punning and is deliberately compiled with -fno-default-real-8 while the rest of the build uses -fdefault-real-8, so its callers can pass explicit SiKi/R4Ki arrays. -fallow-argument-mismatch is already applied to downgrade them to warnings.

However, Debug builds add -pedantic, which promotes the argument mismatches back to errors and overrides -fallow-argument-mismatch. Appending -Wno-pedantic to this file's compile flags restores the intended behaviour. The suppression is scoped to this single legacy source; Release builds are unaffected as they do not pass -pedantic.

Verified on gfortran 12.2.0 (linux) and 15.2.0 (macosx) with

cmake -DDOUBLE_PRECISION=On -DCMAKE_BUILD_TYPE=Debug -DGENERATE_TYPES=On ..

Isolation test on the exact compile line:

Build Flags Results
-pedantic 64 errors
-pedantic -std=legacy 64 errors
-pedantic -Wno-argument-mismatch 64 errors
-pedantic -Wno-pedantic 0 errors (object builds)

Related issue, if one exists
Introduced in PR #3412

Impacted areas of the software
Compilation with certain compilers on linux and macosx

Additional supporting information
caught by ai during testing for a new feature.

Generative AI usage
Co-authored-by: GitHub Copilot copilot@github.com
Co-authored-by: Claude Opus 5 noreply@anthropic.com

Test results, if applicable
None affected

…ment-mismatch)

Debug builds with gfortran fail to compile fftpack5.1.f with 64 hard errors:

  Error: Type mismatch in argument 'dsum' at (1); passed REAL(4) to REAL(8)
  Error: Type mismatch in argument 'c' at (1); passed REAL(4) to COMPLEX(4)

These mismatches are intentional: FFTPACK 5.1 uses legacy Fortran 77 type
punning and is deliberately compiled with -fno-default-real-8 while the rest
of the build uses -fdefault-real-8, so its callers can pass explicit SiKi/R4Ki
arrays. -fallow-argument-mismatch is already applied to downgrade them to
warnings.

However, Debug builds add -pedantic, which promotes the argument mismatches
back to errors and overrides -fallow-argument-mismatch. Appending
-Wno-pedantic to this file's compile flags restores the intended behaviour.
The suppression is scoped to this single legacy source; Release builds are
unaffected as they do not pass -pedantic.

Verified on gfortran 12.2.0 with
  cmake -DDOUBLE_PRECISION=On -DCMAKE_BUILD_TYPE=Debug -DGENERATE_TYPES=On ..
Isolation test on the exact compile line:
  -pedantic                            -> 64 errors
  -pedantic -std=legacy                -> 64 errors
  -pedantic -Wno-argument-mismatch     -> 64 errors
  -pedantic -Wno-pedantic              ->  0 errors (object builds)

Co-authored-by: GitHub Copilot <copilot@github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Scopes a GNU Fortran Debug-build diagnostic suppression to the legacy FFTPACK 5.1 single-file source so that intentional Fortran 77 argument/type punning continues to compile under -pedantic.

Changes:

  • Adds -Wno-pedantic to the per-source compile flags for src/NetLib/fftpack/fftpack5.1.f when using GNU Fortran.
  • Documents why this suppression is needed alongside the existing per-file GNU flags (-fallow-argument-mismatch, -fno-default-real-8, -fno-default-double-8).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@andrew-platt
andrew-platt merged commit d17f6a4 into OpenFAST:dev Aug 20, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants