RFR: 8360281: VMError::error_string has incorrect format usage

Kim Barrett kbarrett at openjdk.org
Mon Jun 23 18:26:34 UTC 2025


On Mon, 23 Jun 2025 18:19:32 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> But why didn't the compiler complain about this? If we send this format string and args through UL we do get an error:
> 
> ```
>     log_info(gc)("%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=%zu",
>                  signame, _id, _pc,
>                  os::current_process_id(), os::current_thread_id());
> ```
> 
> ```
> /Users/stefank/git/jdk/open/src/hotspot/share/utilities/vmError.cpp:268:32: error: format specifies type 'unsigned long' but the argument has type 'address' (aka 'unsigned char *') [-Werror,-Wformat]
>                  signame, _id, _pc,
> ```

Because of https://bugs.openjdk.org/browse/JDK-8198918
jio_snprintf and friends are not checked by -Wformat

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25935#issuecomment-2997488351


More information about the hotspot-dev mailing list