RFR: 8302124: HotSpot Style Guide should permit noreturn attribute
Kim Barrett
kbarrett at openjdk.org
Mon Feb 13 02:36:27 UTC 2023
On Sun, 12 Feb 2023 11:57:33 GMT, Andrew Haley <aph at openjdk.org> wrote:
> > > I'd be careful. A call to an error routine marked noreturn can turn into a tail call (i.e. a jump) to it. That messes up backtraces.
> >
> >
> > Explicitly not so for gcc. https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Common-Function-Attributes.html#Common-Function-Attributes Under "noreturn" "In order to preserve backtraces, GCC will never turn calls to noreturn functions into tail calls." I don't know about other compilers, but I would think they would want to do something similar.
>
> Mm, interesting. I see it's been like that for a while, but only recently has that been explicit in the docs. I think we'd want to check for other compilers.
I wasn't able to find anything in the Visual Studio docs about this question. Not authoritative, but I did find this:
https://stackoverflow.com/questions/55656938/why-noreturn-builtin-unreachable-prevents-tail-call-optimization
-------------
PR: https://git.openjdk.org/jdk/pull/12507
More information about the hotspot-dev
mailing list