8065585: Change ShouldNotReachHere() to never return

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Fri Apr 17 09:13:02 UTC 2015

Hi Kim, Stefan,

yes, I saw the other two possibilities.  I tried both of them.
I also tried an example with uninitialized code.  I thought that
works, but actually xlC never warns about that.

I asked our IBM contacts about this.  I'll share it in case they 
come up with a solution.

I also tried HP aCC, that shows the very same behaviour as xlC.
No warning about uninitialized code, no effect of the attribute
on returns.  I didn't dig into this, though.
(We have a windows/linux/hp ia64 port internally.)

So maybe keeping/adding returns is the better solution...

Best regards,

-----Original Message-----
From: Kim Barrett [mailto:kim.barrett at oracle.com] 
Sent: Donnerstag, 16. April 2015 19:34
To: Lindenmaier, Goetz
Cc: Stefan Karlsson; hotspot-dev Source Developers
Subject: Re: 8065585: Change ShouldNotReachHere() to never return

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

More information about the hotspot-dev mailing list