Skip to content

Fix compile error in AT_lambda_Vavilov_FWHM under GCC 16 / C23 - #288

Open
grzanka wants to merge 1 commit into
masterfrom
claude/github-issue-287-xo4bj2
Open

Fix compile error in AT_lambda_Vavilov_FWHM under GCC 16 / C23#288
grzanka wants to merge 1 commit into
masterfrom
claude/github-issue-287-xo4bj2

Conversation

@grzanka

@grzanka grzanka commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

AT_lambda_Vavilov_FWHM in src/AT_EnergyLoss.c called AT_lambda_Landau_FWHM_left(kappa, beta), but AT_lambda_Landau_FWHM_left is declared and defined with no parameters. Under C17 and earlier, an empty parameter list () in a non-prototype declaration meant "unspecified arguments," so compilers tolerated the extra arguments. C23 (the default standard in GCC 16) changes this: () now means the function takes exactly zero parameters, so the call becomes a hard compile error ("too many arguments to function").

The correct counterpart to AT_lambda_Vavilov_FWHM_right(kappa, beta) is AT_lambda_Vavilov_FWHM_left(kappa, beta), which already exists in the same file and takes kappa/beta — it was simply the wrong function being called.

// before
double AT_lambda_Vavilov_FWHM(const double kappa, const double beta) {
    return (AT_lambda_Vavilov_FWHM_right(kappa, beta) - AT_lambda_Landau_FWHM_left(kappa, beta));
}

// after
double AT_lambda_Vavilov_FWHM(const double kappa, const double beta) {
    return (AT_lambda_Vavilov_FWHM_right(kappa, beta) - AT_lambda_Vavilov_FWHM_left(kappa, beta));
}

This also fixes a latent logic bug: AT_lambda_Vavilov_FWHM was mixing a Vavilov-distribution FWHM-right value with a Landau-distribution FWHM-left value (a constant, independent of kappa/beta), instead of using the matching Vavilov-distribution left value.

Test plan

  • Reproduced the exact compiler diagnostic ("too many arguments to function") with a minimal repro compiled under -std=c2x (C23 semantics), confirming this is the root cause of the GCC 16 failure.
  • Compiled src/AT_EnergyLoss.c standalone with gcc -std=c2x after the fix — no errors.
  • Full CMake/CI build (not run locally in this environment; will be verified by CI on this PR).

Fixes #287


Generated by Claude Code

… args

AT_lambda_Landau_FWHM_left() takes no arguments, but AT_lambda_Vavilov_FWHM
called it as AT_lambda_Landau_FWHM_left(kappa, beta). Under C23 (default in
GCC 16), an empty parameter list means the function takes no parameters at
all, so this call fails to compile with "too many arguments to function".

The correct counterpart is AT_lambda_Vavilov_FWHM_left(kappa, beta), which
already exists and is used the same way AT_lambda_Vavilov_FWHM_right is.

Fixes #287

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a C23/GCC 16 compile error (and a matching logic bug) in AT_lambda_Vavilov_FWHM by replacing an incorrect call to the zero-argument AT_lambda_Landau_FWHM_left() with the correct two-argument AT_lambda_Vavilov_FWHM_left(kappa, beta).

Changes:

  • Corrected AT_lambda_Vavilov_FWHM to compute the Vavilov FWHM width as right - left using Vavilov endpoints.
  • Eliminated a C23 “too many arguments to function” error by removing arguments from the Landau-left function call (by no longer calling it there).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grzanka
grzanka requested a review from PiotrPich2024 July 29, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GCC 16 not compiling

3 participants