Repository navigation
Fix #15113 FP nullPointer with pthread functions - #8946
Open
chrchr-github wants to merge 4 commits into
Open
chrchr-github wants to merge 4 commits into
chrchr-github wants to merge 4 commits into
Conversation
chrchr-github
marked this pull request as ready for review
October 16, 2026 13:15
dmcppcheck
reviewed
Oct 16, 2026
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
I found no problems. Removing <not-null/> from argument 2 of pthread_cond_init and argument 2 of pthread_cleanup_push matches POSIX: a NULL attr means the default attributes, and arg is passed unchanged to the cleanup routine. <not-uninit/> is kept, so an uninitialised argument is still reported for both. Other functions that accept NULL, such as pthread_mutex_init and pthread_create, already allow it in the config, so the change matches them. The new tests in test/cfg/posix.c cover the NULL case and the uninitialised case.
Testing
- I built
cppcheckfrompr/. I did not buildtestrunnerbecause this PR changes onlycfg/andtest/cfg/. - I ran the library test on
test/cfg/posix.cwith the options fromtest/cfg/runtests.sh(--check-library --check-level=exhaustive --enable=style,information --inconclusive --inline-suppr --debug-warnings --library=posix). It reported nothing, so there were no unmatched suppressions and no unexpected warnings. - I compared the old and new config on a scratch file. I ran the PR's binary on it twice, once with
--library=/tmp/baseposix.cfg(a copy of the baseposix.cfg) and once with--library=posix:
#include <pthread.h>
void f(pthread_cond_t *c, void (*r)(void*)) {
pthread_cond_init(c, NULL);
pthread_cleanup_push(r, NULL);
pthread_cleanup_pop(0);
pthread_cond_t c2;
pthread_cond_init(&c2, 0);
pthread_condattr_t *a;
pthread_cond_init(&c2, a);
void *p;
pthread_cleanup_push(r, p);
pthread_cleanup_pop(1);
}- Base config: 3
nullPointerfalse positives (lines 3, 4 and 7) and 2uninitvar(lines 9 and 11). - PR config: only the 2 correct
uninitvarwarnings (lines 9 and 11).
Automated review of a76d465 by Claude. The pull request was built and tested locally.
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.
No description provided.