From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6BCC4385782B; Thu, 19 Oct 2023 15:44:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BCC4385782B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697730288; bh=h217Th0gaWROvwz/nqke+TkoTRFztO1c+ercnosCyPE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oWYEfBYgFLxe/91/MIHf6cGskbacQTt2cwEmr+4DJmRnYzxC0yT68vBiQ61rXpbSE FybfV0wXdstNqy28nROFmgyWtyvm/if4x8PF8C5WuHGKHQr7SrWoN1LJcwJWQ0D2GK f5zULusuSlFvt+HMy0Az20rIdMJt/or33fm+BfBg= From: "sgk at troutmask dot apl.washington.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/110644] Error in gfc_format_decoder Date: Thu, 19 Oct 2023 15:44:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sgk at troutmask dot apl.washington.edu X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110644 --- Comment #7 from Steve Kargl -= -- On Thu, Oct 19, 2023 at 08:00:27AM +0000, aluaces at udc dot es wrote: >=20 > It says something about a non-recursive function likely calling itself. = I will > inspect my source, even it is a bit too big. Maybe a better solution wou= ld be > if I compiled gcc with debugging flags. Can I just use C_FLAGS=3D"-O0 -g= " and > CXX_FLAGS=3D"-O0 -g" at configure time, or if is there a specific configu= re flag? I doubt that these options will help with this problem. Those are for building your application with debugging info. The issue is the compiler itself is dying. > 1078 gcc_assert (loc->nextc - loc->lb->line >=3D 0); > (gdb) bt > #0 gfc_format_decoder (pp=3D0x2706750, text=3D0x7fffffffb840, spec=3D0x2= 708d10 "L", > precision=3D, wide=3Dfalse, set_locus=3Dfalse, hash=3Dfals= e, > quoted=3D0x7fffffffb667, buffer_ptr=3D0x2708b00) > at ../../gcc-13.2.0/gcc/fortran/error.cc:1078 > #1 0x0000000001b44c0a in pp_format (pp=3D, > text=3Dtext@entry=3D0x7fffffffb840) at ../../gcc-13.2.0/gcc/pretty-print.= cc:1475 > #2 0x0000000001b34e02 in diagnostic_report_diagnostic (context=3D0x26ee3= 80 > , diagnostic=3Ddiagnostic@entry=3D0x7fffffffb8= 40) at > ../../gcc-13.2.0/gcc/diagnostic.cc:1592 > #3 0x000000000071cbc8 in gfc_report_diagnostic (diagnostic=3D0x7fffffffb= 840) at > ../../gcc-13.2.0/gcc/fortran/error.cc:890 > #4 gfc_warning(int, const char *, typedef __va_list_tag __va_list_tag *) > (opt=3D0, > gmsgid=3D0x1c9c420 "Non-RECURSIVE procedure %qs at %L is possibly cal= ling > itself recursively. Declare it RECURSIVE or use %<-frecursive%>", > ap=3Dap@entry=3D0x7fffffffb9c8) > at ../../gcc-13.2.0/gcc/fortran/error.cc:923 > #5 0x000000000071d287 in gfc_warning (opt=3Dopt@entry=3D0, > gmsgid=3Dgmsgid@entry=3D0x1c9c420 "Non-RECURSIVE procedure %qs at %L is p= ossibly > calling itself recursively. Declare it RECURSIVE or use %<-frecursive%>") > at ../../gcc-13.2.0/gcc/fortran/error.cc:954 I suspect that the locus associate with %L in the above error message is undefined (i.e., a NULL pointer). This likely means expr in the next frame is missing some info. > #6 0x00000000007a275f in resolve_procedure_expression (expr=3D0x32a9530)= at > ../../gcc-13.2.0/gcc/fortran/resolve.cc:1956 Can you do=20 (gdb) up 6 (gdb) p *expr You'll likely see expr->where is either NULL or its components are. My sources are bit newer, resolve.cc:1974 is if (is_illegal_recursion (sym, gfc_current_ns)) gfc_warning (0, "Non-RECURSIVE procedure %qs at %L is possibly calling" " itself recursively. Declare it RECURSIVE or use" " %<-frecursive%>", sym->name, &expr->where); You can try replacing &expr->where with gfc_current_locus. I don't remember if the & is needed with gfc_current_locus.=