Skip to content

Clang and icpx: TaylorState compiles, no warnings - #11

Merged
dmalhotra merged 2 commits into
masterfrom
unused-lambda-captures
Nov 10, 2026
Merged

dmalhotra merged 2 commits into
masterfrom
unused-lambda-captures

Conversation

@dmalhotra

@dmalhotra dmalhotra commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

BIEST compiles as C++17 with Clang and Intel icpx, without warnings. Before, Clang 18, 19 and icpx 2025 rejected the TaylorState code, and gave 54 warnings with -Wall -Wfloat-conversion for the tests and examples. GCC accepted the code and gave no warnings.

Changes

  • TaylorState::ComputeFarField: one declaration for each OffSurfaceOp (9212ded). OffSurfaceOp op_grad(helm.FxdU(), comm), op_potn(helm.FxU(), comm); declared two objects whose class template arguments are deduced as different types, which C++17 does not allow in one declaration. test/bie-solvers and doc/examples/taylor-state-shell did not compile with Clang or icpx.
  • Unused lambda captures and a floating-point condition (604c8b3):
    • SingularCorrection::SetupTarget: interp captures INTERP_ORDER and NV, which are compile-time constants for IORD = 16 and run-time values, which need the capture, for IORD = 0. SCTL_UNUSED marks the captures as used, and the body still reads the compile-time constants. An init-capture (INTERP_ORDER = INTERP_ORDER) also silences the warning, but GCC 13.3 and Clang 19 then generate different code for the interpolation.
    • TaylorState::ComputeHelper: print_imag_norm uses real_imag_part only with BIEST_VERBOSE; SCTL_UNUSED.
    • Tests: captures of constants and of a variable that is not used are removed, and a double used as a condition is compared with 0.

Tests

On a 128-core AMD Rome node of the Flatiron cluster:

  • The 4 tests and 7 examples compile with -std=c++17 -Wall -Wfloat-conversion without warnings with GCC 11.5, 13.3, 14.2, Clang 18.1, 19.1 and icpx 2025.0. So do virtual-casing (its tests, library and Python module, with its own unused captures removed) and the fbtools bindings, with this BIEST.
  • With the source line numbers made equal (empty lines added to master where this branch adds lines), the examples compile (-O2) to the same object files as master: all 7 with GCC 13.3, and with Clang 19 and icpx 2025 the 6 that compile on master.
  • The 4 tests pass with GCC 13.3 (-O3), with output identical to master's.
  • The 4 tests built with Clang 19 and with icpx 2025 (-O3) compile without warnings and pass.

🤖 Generated with Claude Code

dmalhotra and others added 2 commits November 10, 2026 17:31
`OffSurfaceOp op_grad(helm.FxdU(), comm), op_potn(helm.FxU(), comm);`
declared two objects whose class template arguments are deduced from
different kernels, as different types. C++17 requires one deduced type
for all the objects of a declaration: Clang 18, 19 and icpx 2025 reject
it, so test/bie-solvers and doc/examples/taylor-state-shell did not
compile with them. GCC accepts it. With one declaration for each object
both files compile with Clang 18, 19 and icpx 2025.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th Clang and icpx

With -Wall -Wfloat-conversion, Clang 19 and icpx 2025 gave 54 warnings
for the tests and examples, GCC none:
- SingularCorrection::SetupTarget: interp captures INTERP_ORDER and NV,
  which are compile-time constants for IORD = 16 and run-time values,
  that need the capture, for IORD = 0. SCTL_UNUSED marks the captures as
  used, and the body still reads the compile-time constants. An
  init-capture (INTERP_ORDER = INTERP_ORDER) also silences the warning,
  but makes them run-time values in the body: GCC 13.3 and Clang 19 then
  generate different code for the interpolation.
- TaylorState::ComputeHelper: print_imag_norm uses real_imag_part only
  with BIEST_VERBOSE.
- test/bie-solvers, test/boundary-integ-op, test/vacuum-field: captures
  of constants and of a variable that is not used are removed, and a
  double used as a condition is compared with 0.

The tests and examples compile without warnings with GCC 11.5, 13.3,
14.2, Clang 18, 19 and icpx 2025, and so do virtual-casing and the
fbtools bindings with this BIEST. With the source line numbers made
equal, the examples compile (-O2) to the same object files as at
95dafcf: all 7 with GCC 13.3, and with Clang 19 and icpx 2025 the 6 that
compile at 95dafcf. The tests pass with GCC 13.3, with output identical
to that of 95dafcf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmalhotra
dmalhotra merged commit 8978b33 into master Nov 10, 2026
7 checks passed
@dmalhotra
dmalhotra deleted the unused-lambda-captures branch November 10, 2026 22:49
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.

1 participant