RFR: 8281213: Unsafe uses of long and size_t in MemReporterBase::diff_in_current_scale [v6]

Kim Barrett kbarrett at openjdk.org
Wed Jan 18 04:41:23 UTC 2023


On Tue, 17 Jan 2023 06:28:44 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/share/services/memReporter.hpp line 80:
>> 
>>> 78: 
>>> 79:     LP64_ONLY(assert(s1 < INT64_MAX, "exceeded possible memory limits");)
>>> 80:     LP64_ONLY(assert(s2 < INT64_MAX, "exceeded possible memory limits");)
>> 
>> Nit: LP64_ONLY isn't needed.
>
> Would a 32-bit compiler not warn about a comparison that is always true?

I don't think so. We don't consider such warnings helpful, because they just
lead to this kind of conditionalization (or dropping such checks altogether).
So far as I know, only clang among widely supported compilers warns about it,
and we've specifically disabled that warning globally because we consider it
non-helpful.

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

PR: https://git.openjdk.org/jdk/pull/11514


More information about the hotspot-runtime-dev mailing list