https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105138
--- Comment #10 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Sun, Apr 03, 2022 at 08:27:03PM +0000, anlauf at gcc dot gnu.org wrote: > --- Comment #9 from anlauf at gcc dot gnu.org --- > (In reply to kargl from comment #8) > > This patch fixes the error. The comment in the patch explains it. > > Good catch, Steve. > > I think this can (and needs to) be simplified further. :-) > > First, the check on sym->result should not be necessary, as > it looks redundant. I agree. I suppose that I was being to cautious with introducing a regression. > Second, we need to handle recursive subroutines, such as: Ah, good catch. The use of sym->result would not catch this. > > /* Check for attributes which prevent the symbol from being INTRINSIC. */ > if (sym->attr.external || sym->attr.contained > + || sym->attr.recursive > || sym->attr.if_source == IFSRC_IFBODY) > return false; > > This regtests OK for me. > Looks good to me.