8065585: Change ShouldNotReachHere() to never return

Kim Barrett kim.barrett at oracle.com
Thu Apr 16 17:34:10 UTC 2015


On Apr 16, 2015, at 4:50 AM, Lindenmaier, Goetz <goetz.lindenmaier at sap.com> wrote:
> the IBM docu says that __notreturn__ affects only warnings about
> uninitialized variables, not about missing returns.

I would summarize it as saying it does affect ununitialized variable
warnings, and as being silent on the subject of missing returns.

> It also says that registers are not stored on a call.
> http://publibfp.boulder.ibm.com/epubs/pdf/c1473260.pdf page 193.

Actually, it says registers saved by the caller might not be restored
before the call.

> For the compiler flags and warnings I get see the compile output below.

The missing return warnings are quite disappointing, even to the level
of a bug. Though the feature documentation is so light, it could
arguably do almost anything.

XLC appears to provide at least three mechanisms for indicating a
function doesn't return.  The __attribute__ method has the weakest
description: "indicate to the compiler that the function is not
intended to return."  The others are

_Noreturn function attribute (similar to inline) - "declares a
function that does not return to its caller."  Added by C11 and
requires special compiler options to enable.

#pragma leaves(function_name, ...) - "Informs the compiler that a
named function never returns to the instruction following a call to
that function."

Goetz, if you have some time (yeah, right), it might be interesting to
find out if either of the other two behave any differently with regard
to missing return warnings.

I will be sad if this proposed change has to be dropped because an
otherwise well-reputed compiler was so lame in this respect. I really
dislike dummy return statements and not having -Wuninitialized turned
on.



More information about the hotspot-dev mailing list