public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf 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: Tue, 12 May 2020 20:21:49 +0000 [thread overview] Message-ID: <bug-95053-4-wBEi9mV2Tj@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 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |--- --- Comment #15 from anlauf at gcc dot gnu.org --- A possible workaround is to partly revert the offending commit and handle problematic cases individually. The original commit intended to handle two different ICEs with a common invalid code. Bill, can you try the following patch? (Note that this needs two adjustments in the testsuite, but otherwise regtests for me. I'm not 100%sure if the PDT part is correct.) diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index dd72f44d377..dd7f5f43930 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -1806,7 +1806,7 @@ gfc_multiply (gfc_expr *op1, gfc_expr *op2) gfc_expr * gfc_divide (gfc_expr *op1, gfc_expr *op2) { - if (op2 && op2->expr_type == EXPR_CONSTANT) + if (0 && op2 && op2->expr_type == EXPR_CONSTANT) { arith rc = ARITH_OK; switch (op2->ts.type) diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index d650407da41..6866f460224 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2602,6 +2602,14 @@ variable_decl (int elem) gfc_free_expr (e); } + if (not_constant && e->ts.type != BT_INTEGER) + { + gfc_error ("Explicit array shape at %C must be constant of " + "INTEGER type and not %s type", + gfc_basic_typename (e->ts.type)); + m = MATCH_ERROR; + goto cleanup; + } if (not_constant) { gfc_error ("Explicit shaped array with nonconstant bounds at %C"); @@ -3736,8 +3744,9 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list, gfc_symbol **sym, if (kind_expr) { /* Try simplification even for LEN expressions. */ + bool ok; gfc_resolve_expr (kind_expr); - gfc_simplify_expr (kind_expr, 1); + ok = gfc_simplify_expr (kind_expr, 1); /* Variable expressions seem to default to BT_PROCEDURE. TODO find out why this is and fix it. */ if (kind_expr->ts.type != BT_INTEGER @@ -3748,6 +3757,12 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list, gfc_symbol **sym, gfc_basic_typename (kind_expr->ts.type)); goto error_return; } + if (kind_expr->ts.type == BT_INTEGER && !ok) + { + gfc_error ("The parameter expression at %C does not " + "simplify to an INTEGER constant"); + goto error_return; + } tail->expr = gfc_copy_expr (kind_expr); }
next prev parent reply other threads:[~2020-05-12 20:21 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 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 [this message] 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-wBEi9mV2Tj@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: linkBe 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).