From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 18C16386F83D; Mon, 11 May 2020 19:07:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18C16386F83D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589224052; bh=aE6fj0ujeLi7XGKhaXx0CGzr6DG1mx5uADMVLv+SRB0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uEKmd+OVnDWXyuAgyoMQBhx4EZumKPCyaYLgkfiGbpE/E/94ZmYbY3CMzO4FSTeJk d/rh5b0p8/gDKbCFnpgMTbkAXmsImfG2OVQ7tnQ1spYKcj0ZfWIrIjS9OWNI9HT9a6 GVhMyeAT2brSOsgBi9RKU4M85WFc7WnBZ6rW2z5A= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/95053] [11 regression] ICE in f951: gfc_divide() Date: Mon, 11 May 2020 19:07:32 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on everconfirmed bug_status 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 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: Mon, 11 May 2020 19:07:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95053 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-05-11 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #6 from anlauf at gcc dot gnu.org --- It gets actually really weird during parsing. The following (invalid) code shows that the parser is still in an early phase where it has not yet decided that it is a FORMAT statement, but rather could be something else: format('x') =3D x end This gives: 1 | format('x') =3D x | 1 Error: The function result on the lhs of the assignment at (1) must have the pointer attribute. while e.g. Intel detects: foo.f90(1): error #6072: A dummy argument of a statement function must be a scalar identifier. ['x'] format('x') =3D x ---------^ The simplest solution is to defer error detection and recovery by restoring the previous behavior when the basic type of operand 2 to gfc_divide is non-numeric: diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index 1cd0867a941..dd72f44d377 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -1828,7 +1828,8 @@ gfc_divide (gfc_expr *op1, gfc_expr *op2) rc =3D ARITH_DIV0; break; default: - gfc_internal_error ("gfc_divide(): Bad basic type"); + /* basic type is non-numeric, handle this elsewhere. */ + break; } if (rc =3D=3D ARITH_DIV0) {=