Repository navigation
Conversation
Restore the stock value conversion specifier in ensureNonNegative error logging. This change prevents argument offset errors and undefined behavior. Add format checking attributes to logprint in src/common/logging.h. Resolve latent format specifier errors identified across the codebase. Add regression assertions in testOutputHeader to verify clamping and error exits.
Labreo
requested review from
Alomir,
dlebauer,
mdietze and
mswilburn
as code owners
October 28, 2026 09:47
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Store test climate data in static storage and reset climate pointer to NULL before returning.
Alomir
approved these changes
Oct 28, 2026
Alomir
left a comment
Collaborator
There was a problem hiding this comment.
Very nice, great addition of __attribute__
Comment on lines
+34
to
+39
| #if defined(__GNUC__) || defined(__clang__) | ||
| #define ATTRIB_PRINTF(fmt_idx, arg_idx) \ | ||
| __attribute__((format(printf, fmt_idx, arg_idx))) | ||
| #else | ||
| #define ATTRIB_PRINTF(fmt_idx, arg_idx) | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
(value %8.5f)toensureNonNegative()error logging and addprintfformat attribute validation tologprint(). Fix compiler-flagged format errors inlimitations.candmodelParams.c.ensureNonNegative(), the error log format string omitted the stock value while keeping*varin the argument list. This caused argument type mismatch and undefined behavior. Adding compile-time format validation prevents format regressions across the codebase.How was this change tested?
Ran local unit tests and smoke tests:
make clean && makemake testbuild && make unitmake smokemake testUpdated
testOutputHeader.cto test clamping and violation error exits.Reproduction steps
Set
plantWoodInitto-10.0intests/smoke/niwot/sipnet.paramand runsipnet. Prior to this fix, the error log prints corrupted timestamp values due to argument register offsets.Related issues
Checklist
docs/CHANGELOG.mdupdated with noteworthy changesclang-format(rungit clang-formatif needed)