RFR: 8308071: [REDO] update for deprecated sprintf for src/utils [v3]
Kim Barrett
kbarrett at openjdk.org
Thu May 18 15:49:51 UTC 2023
On Wed, 17 May 2023 14:51:49 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
>> src/utils/hsdis/binutils/hsdis-binutils.c line 246:
>>
>>> 244:
>>> 245: size_t used_size = snprintf(buf, bufsize, "%s", close);
>>> 246: if ((used_size < 0) || (used_size >= bufsize)) {
>>
>> (used_size < 0) is tautologically false, since used_size is a size_t, so unsigned. I'm somewhat surprised
>> this doesn't trigger a warning from some compiler.
>
> Updated to use `int` to replace `size_t.`. Thank you for the catching.
bufsize is size_t, so that's a comparison between signed and unsigned values, which I think some compilers
will warn about. Maybe the preceding check for negative is getting rid of that? But will that still occur in
a slowdebug build, or will the lack of optimization lead to a warning?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13995#discussion_r1197985875
More information about the build-dev
mailing list