unix/mpthreadport: Fix type / comparison of PTHREAD_STACK_MIN. #17440
+2
−2
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
When compiling the unix port on my recently updated ubuntu machine I ran into this error:
It looks like my gcc was updated:
The variable
PTHREAD_STACK_MIN
is defined by the pthread libraries:It seems GCC 14 got stricter with warn/errs like
-Wsign-compare
and types a "bare number" as along int
that can't be compared to a (unsigned)size_t
?Testing
With this change the unix port compiled again. The thread unit tests pass:
[corona@Telie tests]$ ./run-tests.py ./thread/thread*.py platform=linux arch=x64 pass ./thread/thread_heap_lock.py pass ./thread/thread_ident1.py pass ./thread/thread_lock1.py pass ./thread/thread_exc2.py pass ./thread/thread_exit2.py pass ./thread/thread_lock2.py pass ./thread/thread_gc1.py pass ./thread/thread_lock5.py pass ./thread/thread_qstr1.py pass ./thread/thread_shared1.py pass ./thread/thread_shared2.py pass ./thread/thread_sleep1.py pass ./thread/thread_lock3.py pass ./thread/thread_lock4.py pass ./thread/thread_stacksize1.py pass ./thread/thread_exit1.py pass ./thread/thread_coop.py pass ./thread/thread_exc1.py pass ./thread/thread_sleep2.py pass ./thread/thread_start1.py pass ./thread/thread_start2.py pass ./thread/thread_stdin.py 22 tests performed (127 individual testcases) 22 tests passed
Trade-offs and Alternatives
The function could accept a ssize_t instead but that's arguably a broader change.
Perhaps there's a compiler flag to work around this default signing of integers a different way?