RFR: 8286562: GCC 12 reports some compiler warnings [v9]
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Thu May 26 10:55:29 UTC 2022
On Thu, 26 May 2022 03:48:31 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Yasumasa Suenaga has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Change Array::data() implementation
>> - Avoid stringop-overflow warning in jfrTraceIdBits.inline.hpp
>
> src/java.base/unix/native/libjli/java_md_common.c line 133:
>
>> 131:
>> 132: snprintf_result = JLI_Snprintf(name, sizeof(name), "%s%c%s", indir, FILE_SEPARATOR, cmd);
>> 133: if ((snprintf_result < 0) && (snprintf_result >= (int)sizeof(name))) {
>
> That should be `||` rather than `&&`.
Good catch! I fixed it in new commit.
> src/java.base/unix/native/libjli/java_md_common.c line 135:
>
>> 133: if ((snprintf_result < 0) && (snprintf_result >= (int)sizeof(name))) {
>> 134: return 0;
>> 135: }
>
> Pre-existing: It seems odd that this returns `0` above and below, rather than returning `NULL`. I think there are one or two other places in this file that are similarly using literal `0` for a null pointer, though others are using `NULL`. Something to report and clean up separately from this change.
I was wondering about that too.
I use `NULL` at L134, and have filed it as [JDK-8287363](https://bugs.openjdk.java.net/browse/JDK-8287363). I will work for it after this issue.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8646
More information about the build-dev
mailing list