-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compiler warnings from utf8.c on 32-bit build #22899
base: blead
Are you sure you want to change the base?
Conversation
…_t in Perl_utf8_to_uv_msgs_helper_() Changed the type of `curlen`, `expectlen`, and `avail_len` from `SSize_t` to `Size_t`, to shut up compiler warnings about comparison between same-sized signed and unsigned values on 32-bit build. These variables represent the number of bytes which cannot be negative, so it should be safe to be unsigned type.
…s_helper_ This call of croak() used to attempt to display U32 variable `this_problem` with %d format specifier, which triggered a compiler warning on 32-bit build where U32 is typedef'ed to unsigned long.
utf8.c
Outdated
@@ -1634,12 +1634,12 @@ Perl_utf8_to_uv_msgs_helper_(const U8 * const s0, | |||
* than a single character */ | |||
const U8 * send = e; | |||
|
|||
SSize_t curlen = send - s0; | |||
Size_t curlen = send - s0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't this be negative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be negative in non-DEBUGGING builds, where s0 <= send
is treated as a reported error. For DEBUGGING builds perl asserts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for comments. I've forgotten a possibility of s0 > send
.
I pushed a new commit to move this subtraction to the point after checking s0 < send
to avoid underflow.
This set of changes will silence compiler warnings from
Perl_utf8_to_uv_msgs_helper_
function at utf8.c on 32-bit (e.g. x86) build: