Improper usage of CHECK macros generates unreachable code
David Holmes - Sun Microsystems
David.Holmes at Sun.COM
Wed Oct 7 03:20:04 PDT 2009
Christian Thalinger said the following on 10/07/09 19:19:
> On Wed, 2009-09-30 at 19:05 +0200, Volker Simonis wrote:
>> If somebody would be so kind to open a bug for this issue, I would contribute
>> a patch which fixes the mentioned 'misuses' of the CHECK macro.
>
> Hi Volker!
>
> Sorry for the long delay. That definitely seems to be a problem. I
> opened:
>
> 6889002: CHECK macros in return constructs lead to unreachable code
I just updated the CR with the following:
I dont think it sufficient to simply replace CHECK with THREAD. The
problem is that the value being returned may be complete garbage. ie given:
return create_string_variable(ns, name, 0, s, CHECK);
the intent is to return NULL if create_string_variable triggers an
exception, but if we change this to:
return create_string_variable(ns, name, 0, s, THREAD);
we don't know what value will be returned without examining the
internals of create_string_variable. So the replacement would be unsafe
unless we verified that create_string_variable always returns NULL if it
detects an exception is generated, but if that were the case there would
be no need to use the CHECK macro in the first place. We may find that
we are returning a garbage value.
Cheers,
David Holmes
More information about the hotspot-dev
mailing list