public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/110644] Error in gfc_format_decoder
Date: Thu, 19 Oct 2023 15:44:47 +0000	[thread overview]
Message-ID: <bug-110644-4-DKX4wchOaA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110644-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110644

--- Comment #7 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Oct 19, 2023 at 08:00:27AM +0000, aluaces at udc dot es wrote:
> 
> 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 would be
> if I compiled gcc with debugging flags.  Can I just use C_FLAGS="-O0 -g" and
> CXX_FLAGS="-O0 -g" at configure time, or if is there a specific configure 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 >= 0);
> (gdb) bt
> #0  gfc_format_decoder (pp=0x2706750, text=0x7fffffffb840, spec=0x2708d10 "L",
> precision=<optimized out>, wide=false, set_locus=false, hash=false,
> quoted=0x7fffffffb667, buffer_ptr=0x2708b00)
>     at ../../gcc-13.2.0/gcc/fortran/error.cc:1078
> #1  0x0000000001b44c0a in pp_format (pp=<optimized out>,
> text=text@entry=0x7fffffffb840) at ../../gcc-13.2.0/gcc/pretty-print.cc:1475
> #2  0x0000000001b34e02 in diagnostic_report_diagnostic (context=0x26ee380
> <global_diagnostic_context>, diagnostic=diagnostic@entry=0x7fffffffb840) at
> ../../gcc-13.2.0/gcc/diagnostic.cc:1592
> #3  0x000000000071cbc8 in gfc_report_diagnostic (diagnostic=0x7fffffffb840) at
> ../../gcc-13.2.0/gcc/fortran/error.cc:890
> #4  gfc_warning(int, const char *, typedef __va_list_tag __va_list_tag *)
> (opt=0,
>     gmsgid=0x1c9c420 "Non-RECURSIVE procedure %qs at %L is possibly calling
> itself recursively.  Declare it RECURSIVE or use %<-frecursive%>",
> ap=ap@entry=0x7fffffffb9c8)
>     at ../../gcc-13.2.0/gcc/fortran/error.cc:923
> #5  0x000000000071d287 in gfc_warning (opt=opt@entry=0,
> gmsgid=gmsgid@entry=0x1c9c420 "Non-RECURSIVE procedure %qs at %L is possibly
> 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=0x32a9530) at
> ../../gcc-13.2.0/gcc/fortran/resolve.cc:1956

Can you do 

(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.

  parent reply	other threads:[~2023-10-19 15:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 16:04 [Bug fortran/110644] New: " kyle.shores44 at gmail dot com
2023-07-12 17:46 ` [Bug fortran/110644] " kargl at gcc dot gnu.org
2023-10-13 19:41 ` jvdelisle at gcc dot gnu.org
2023-10-16 14:32 ` kyle.shores44 at gmail dot com
2023-10-18 15:56 ` aluaces at udc dot es
2023-10-18 17:03 ` sgk at troutmask dot apl.washington.edu
2023-10-19  8:00 ` aluaces at udc dot es
2023-10-19 15:44 ` sgk at troutmask dot apl.washington.edu [this message]
2023-10-19 16:00 ` aluaces at udc dot es
2023-10-19 16:19 ` sgk at troutmask dot apl.washington.edu
2023-10-20 15:13 ` aluaces at udc dot es
2023-10-20 17:29 ` sgk at troutmask dot apl.washington.edu
2023-10-23 15:16 ` aluaces at udc dot es
2024-03-06  3:40 ` jvdelisle at gcc dot gnu.org
2024-03-08 16:44 ` kyle.shores44 at gmail dot com
2024-03-08 16:56 ` kyle.shores44 at gmail dot com
2024-03-08 17:22 ` sgk at troutmask dot apl.washington.edu
2024-03-08 17:42 ` kyle.shores44 at gmail dot com
2024-03-08 17:42 ` kyle.shores44 at gmail dot com
2024-03-08 19:44 ` sgk at troutmask dot apl.washington.edu
2024-03-08 20:01 ` kyle.shores44 at gmail dot com
2024-03-08 20:32 ` sgk at troutmask dot apl.washington.edu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110644-4-DKX4wchOaA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).