public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/101281] New: [11/12 Regression] ICE with -std=f2003/f2008 and assumed-rank array
Date: Thu, 01 Jul 2021 09:51:54 +0000	[thread overview]
Message-ID: <bug-101281-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 101281
           Summary: [11/12 Regression] ICE with -std=f2003/f2008 and
                    assumed-rank array
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Created attachment 51094
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51094&action=edit
Compile with -std=f2003 or -std=f2008

Found when working on a BIND(C) character testcase. Can probably be reduced.

The problem seems to be related to assumed-rank arrays and it only occurs (at
least in this testcase) for -std=f2003 and -std=f2008, i.e. it works with
-std=-f2008.

I did see it with GCC 11 and GCC 12 - but GCC 10 also showed:
(null):0: confused by earlier errors, bailing out

For some reasons, it does sometimes not crash with 'f951' in the debugger,
unless I pass '-quiet'

It looks as if some error recovery is failing. In any case:

0x00000000008e6ca6 in gfc_resolve_expr (e=0x270a9f0) at
../../repos/gcc/gcc/fortran/resolve.c:7085
7085      else if (e->symtree != NULL
(gdb) p e->symtree
$1 = (gfc_symtree *) 0x270a9b0
(gdb) p e->symtree->n.sym
$2 = (gfc_symbol *) 0x0

The proc being processed is:

(gdb) p gfc_current_ns->proc_name->name
$9 = 0x7ffff716f258 "a3ar"


Depending how the code is reduced, the ICE is gone. However, I did not try very
hard to reduce the code.


Stacktrace is:

(gdb) p *e
$6 = {expr_type = EXPR_VARIABLE, ts = {type = BT_UNKNOWN,
and all values are 0 except for 'where' and 'symtree'.


ICEs in

0xeb368f crash_signal
        ../../repos/gcc/gcc/toplev.c:328
0x8e6ca6 gfc_resolve_expr(gfc_expr*)
        ../../repos/gcc/gcc/fortran/resolve.c:7086
0x8ea58a gfc_resolve_expr(gfc_expr*)
        ../../repos/gcc/gcc/fortran/resolve.c:7071
0x8ea58a resolve_index_expr
        ../../repos/gcc/gcc/fortran/resolve.c:12444
0x8ea58a resolve_charlen
        ../../repos/gcc/gcc/fortran/resolve.c:12497
0x8ee550 resolve_charlen
        ../../repos/gcc/gcc/fortran/resolve.c:12465
0x8ee550 resolve_types
        ../../repos/gcc/gcc/fortran/resolve.c:17343

             reply	other threads:[~2021-07-01  9:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  9:51 burnus at gcc dot gnu.org [this message]
2021-07-01 10:04 ` [Bug fortran/101281] " burnus at gcc dot gnu.org
2021-07-01 10:29 ` rguenth at gcc dot gnu.org
2021-07-28  7:07 ` rguenth at gcc dot gnu.org
2022-04-21  7:49 ` rguenth at gcc dot gnu.org
2023-05-29 10:05 ` [Bug fortran/101281] [11/12/13/14 " jakub at gcc dot gnu.org

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-101281-4@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).