Skip to content

Fix C++11 wrapper shape detection for const and empty arrays - #1643

Merged
GiovanniBussi merged 1 commit into
plumed:masterfrom
GiovanniBussi:agents/revise-wrapper-cxx-passing-shapes
Nov 18, 2026
Merged

GiovanniBussi merged 1 commit into
plumed:masterfrom
GiovanniBussi:agents/revise-wrapper-cxx-passing-shapes

Conversation

@GiovanniBussi

Copy link
Copy Markdown
Member

Const custom arrays lost their unqualified trait or attempted to cast away const. Empty std::array objects acquired a nonzero sizeof-derived extent and recursive flattening could turn an empty outer dimension into a nonempty shape. Fixed custom arrays also used overloaded address operators, and container detection/size access rejected valid mutable or lvalue-qualified APIs.

Preserve exact trait specializations while inheriting const customizations, use std::array logical storage size and data(), acquire real object addresses, and probe/access named container arguments as lvalues. Preserve empty metadata through recursive shape deduction and reject nested dynamic containers rather than describe their container objects as contiguous scalar data. Keep the C ABI, legacy pointer policy, existing custom layout contract and C++11 compatibility. Production changes are confined to src/wrapper/Plumed.h.

Add a standalone metadata-capture regtest, compile-rejection probes and a short case/compatibility document. Clang 17 and GCC 15 pass C++11/14/17 strict/legacy matrices; Clang ASan/UBSan strict/legacy checks pass. The new fixture passes the normal runner in C++11, and existing rt-make-10/11 numerical tests pass against the candidate header and a fresh serial kernel. Baseline probes reproduce all corrected failures. Anonymous namespace, C++98, disabled shape detection and C99 smoke checks pass. Cross-platform CI is pending publication.

Signed-off-by: Giovanni Bussi bussi@sissa.it

Agent: Codex (/root); no other agents collaborated.

Const custom arrays lost their unqualified trait or attempted to cast away
const. Empty std::array objects acquired a nonzero sizeof-derived extent and
recursive flattening could turn an empty outer dimension into a nonempty
shape. Fixed custom arrays also used overloaded address operators, and
container detection/size access rejected valid mutable or lvalue-qualified APIs.

Preserve exact trait specializations while inheriting const customizations,
use std::array logical storage size and data(), acquire real object addresses,
and probe/access named container arguments as lvalues. Preserve empty metadata
through recursive shape deduction and reject nested dynamic containers rather
than describe their container objects as contiguous scalar data. Keep the C ABI,
legacy pointer policy, existing custom layout contract and C++11 compatibility.
Production changes are confined to src/wrapper/Plumed.h.

Add a standalone metadata-capture regtest, compile-rejection probes and a short
case/compatibility document. Clang 17 and GCC 15 pass C++11/14/17 strict/legacy
matrices; Clang ASan/UBSan strict/legacy checks pass. The new fixture passes the
normal runner in C++11, and existing rt-make-10/11 numerical tests pass against
the candidate header and a fresh serial kernel. Baseline probes reproduce all
corrected failures. Anonymous namespace, C++98, disabled shape detection and
C99 smoke checks pass. Cross-platform CI is pending publication.

Signed-off-by: Giovanni Bussi <bussi@sissa.it>

Agent: Codex (/root); no other agents collaborated.
@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.97%. Comparing base (e2c02be) to head (8becf98).
⚠️ Report is 41 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1643    +/-   ##
========================================
  Coverage   88.96%   88.97%            
========================================
  Files         649      651     +2     
  Lines       81194    81815   +621     
========================================
+ Hits        72238    72795   +557     
- Misses       8956     9020    +64     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GiovanniBussi
GiovanniBussi merged commit 69f5ecd into plumed:master Nov 18, 2026
83 of 84 checks passed
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