From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BDFFB3893654; Mon, 11 May 2020 19:35:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDFFB3893654 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589225738; bh=WABjEA9D6K+ivg7atd+Yzry4e8ez7kYtcgJUS5BgIRU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qzFFPo2SFBneo+Wbtx776k159JeaLDOknuNivSBwcGy1RwaYeASQISJ7fwDK0LLrb 1Jm0RbnPrmqVKJgSII6LKOEumjbwn7VHn6NTdB6qjXskG4P2dIZjsp+9gDQMnurk1G 48mezkCyr+PZWQk9NFVaearw7vjmRND9Ico5FTBI= From: "kargl 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:35:38 +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: kargl at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: anlauf at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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:35:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95053 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #9 from kargl at gcc dot gnu.org --- (In reply to anlauf from comment #6) > It gets actually really weird during parsing. Nah. gfortran runs a sequence of matchers, and queues errors as it runs. If a matcher is not found, then (normally only) the last queued error message is emitted. If a matcher is found, the error message queue is cleaned up. > 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: >=20 > format('x') =3D x > end >=20 > This gives: >=20 > 1 | format('x') =3D x > | 1 > Error: The function result on the lhs of the assignment at (1) must have = the > pointer attribute. >=20 > while e.g. Intel detects: >=20 > foo.f90(1): error #6072: A dummy argument of a statement function must be= a > scalar identifier. ['x'] > format('x') =3D x > ---------^ gfortran and ifort are simply trying different sequences of matchers. > The simplest solution is to defer error detection and recovery by restori= ng > the previous behavior when the basic type of operand 2 to gfc_divide is > non-numeric: >=20 > 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) > { >>From my long forgotten days of working in arith.c, it is almost always wrong to emit a gfc_internal_error. Typical an error message is generated during simplification or resolution that catches a problems.=