From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5D607384F02A; Thu, 1 Jul 2021 09:51:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D607384F02A From: "burnus at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: error-recovery, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2021 09:51:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101281 Bug ID: 101281 Summary: [11/12 Regression] ICE with -std=3Df2003/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=3D51094&action=3Dedit Compile with -std=3Df2003 or -std=3Df2008 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=3Df2003 and -std=3Df2008, i.e. it works wi= th -std=3D-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=3D0x270a9f0) at ../../repos/gcc/gcc/fortran/resolve.c:7085 7085 else if (e->symtree !=3D NULL (gdb) p e->symtree $1 =3D (gfc_symtree *) 0x270a9b0 (gdb) p e->symtree->n.sym $2 =3D (gfc_symbol *) 0x0 The proc being processed is: (gdb) p gfc_current_ns->proc_name->name $9 =3D 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 =3D {expr_type =3D EXPR_VARIABLE, ts =3D {type =3D 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=