public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-95053-4-tSVvycXnFf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95053-4@http.gcc.gnu.org/bugzilla/>

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

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:
> 
>   format('x') = x
> end
> 
> This gives:
> 
>     1 |   format('x') = 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') = x
> ---------^

gfortran and ifort are simply trying different sequences of
matchers.

> 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 = ARITH_DIV0;
>           break;
>         default:
> -         gfc_internal_error ("gfc_divide(): Bad basic type");
> +         /* basic type is non-numeric, handle this elsewhere.  */
> +         break;
>         }
>        if (rc == 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.

  parent reply	other threads:[~2020-05-11 19:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 10:57 [Bug fortran/95053] New: [11.0 " juergen.reuter at desy dot de
2020-05-11 12:07 ` [Bug fortran/95053] " juergen.reuter at desy dot de
2020-05-11 12:25 ` anlauf at gmx dot de
2020-05-11 13:02 ` rguenth at gcc dot gnu.org
2020-05-11 15:30 ` [Bug fortran/95053] [11 " juergen.reuter at desy dot de
2020-05-11 17:09 ` anlauf at gcc dot gnu.org
2020-05-11 18:15 ` kargl at gcc dot gnu.org
2020-05-11 19:07 ` anlauf at gcc dot gnu.org
2020-05-11 19:27 ` cvs-commit at gcc dot gnu.org
2020-05-11 19:34 ` anlauf at gcc dot gnu.org
2020-05-11 19:35 ` kargl at gcc dot gnu.org [this message]
2020-05-11 23:59 ` seurer at linux dot vnet.ibm.com
2020-05-12 17:21 ` seurer at linux dot vnet.ibm.com
2020-05-12 17:30 ` anlauf at gcc dot gnu.org
2020-05-12 18:43 ` seurer at linux dot vnet.ibm.com
2020-05-12 18:52 ` sgk at troutmask dot apl.washington.edu
2020-05-12 20:21 ` anlauf at gcc dot gnu.org
2020-05-13  4:46 ` tkoenig at gcc dot gnu.org
2020-05-13 16:09 ` seurer at linux dot vnet.ibm.com
2020-05-13 21:31 ` seurer at linux dot vnet.ibm.com
2020-05-13 22:28 ` seurer at linux dot vnet.ibm.com
2020-05-14  6:04 ` anlauf at gcc dot gnu.org
2020-05-14 12:46 ` seurer at linux dot vnet.ibm.com
2020-05-14 14:57 ` wschmidt at gcc dot gnu.org
2020-05-14 17:08 ` sgk at troutmask dot apl.washington.edu
2020-05-14 17:34 ` wschmidt at linux dot ibm.com
2020-05-14 17:42 ` wschmidt at gcc dot gnu.org
2020-05-14 18:39 ` tkoenig at gcc dot gnu.org
2020-05-14 19:13 ` sgk at troutmask dot apl.washington.edu
2020-05-16 12:33 ` anlauf at gcc dot gnu.org
2020-05-18 18:28 ` cvs-commit at gcc dot gnu.org
2020-05-18 18:54 ` anlauf 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-95053-4-tSVvycXnFf@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).