Integrated: 8255389: ConcurrentHashTable::NoOp omits return in non-void return method

Aleksey Shipilev shade at openjdk.java.net
Tue Oct 27 08:23:24 UTC 2020


On Mon, 26 Oct 2020 09:41:12 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Static analysis complains there is a non-void return method without a return statement:
> 
>   struct NoOp {
>     void operator()(VALUE*) {}
>     const VALUE& operator()() {} // <--- here
>     void operator()(bool, VALUE*) {}
>   } noOp;
> 
> AFAICS, this is UB, and we have seen cases like these break compilers in other places. Not in this case, though, because `noOp` is only used as the default functor in `remove`, which does not use this getter-like definition. Still, it would be good to remove that risky definition, so that it is not used accidentally.

This pull request has now been integrated.

Changeset: dccfd2b3
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/dccfd2b3
Stats:     11 lines in 1 file changed: 3 ins; 7 del; 1 mod

8255389: ConcurrentHashTable::NoOp omits return in non-void return method

Reviewed-by: kbarrett, rehn

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

PR: https://git.openjdk.java.net/jdk/pull/863


More information about the hotspot-dev mailing list