https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109575
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Fri, Apr 21, 2023 at 08:24:45PM +0000, anlauf at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109575 > > --- Comment #2 from anlauf at gcc dot gnu.org --- > I have some idea how (and where) the runtime checks need to be implemented, > but I am confused by the following observations on the occurence of an > explicit RETURN statement and the use of a RESULT variable: > > __attribute__((fn spec (". "))) > integer(kind=4) q2 () > { > integer(kind=4) f; > > f = 2; > return f; > } > > > __attribute__((fn spec (". "))) > integer(kind=4) g () > { > integer(kind=4) __result_g; > > return __result_g; > return __result_g; > } > So, if I follow you correctly, you're worried by about the two 'return __result_g' versus the one 'return f'? Dead code elimination likely removes the second 'return __result_g'. It indeed seems odd!