public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] Fortran : ICE in gfc_trans_label_assign PR50392 Date: Thu, 17 Sep 2020 17:04:26 +0000 (GMT) [thread overview] Message-ID: <20200917170426.EA6CB398792C@sourceware.org> (raw) https://gcc.gnu.org/g:68f72fe0a13fe38190d3447ae98377b6b005c696 commit 68f72fe0a13fe38190d3447ae98377b6b005c696 Author: Mark Eggleston <markeggleston@gcc.gnu.org> Date: Thu May 7 08:15:26 2020 +0100 Fortran : ICE in gfc_trans_label_assign PR50392 A function may contain an assigned goto. If the the return variable is an integer a statement can be assigned to it. Prior to this fix this resulted in an ICE. 2020-05-28 Tobias Burnus <tobias@codesourcery.com> gcc/fortran/ PR fortran/50392 * trans-decl.c (gfc_get_symbol_decl): Remove unnecessary block delimiters. Add auxiliary variables if a label is assigned to a return variable. (gfc_gat_fake_result): If the symbol has an assign attribute set declaration from the symbol's backend declaration. 2020-05-28 Mark Eggleston <markeggleston@gnu.gcc.org> gcc/testsuite/ PR fortran/50392 * gfortran.dg/pr50392.f: New test. (cherry picked from commit a7fd43c38f7469a3ef5ee30e889d60e1376d4dfc) Diff: --- gcc/fortran/trans-decl.c | 11 ++++++++--- gcc/testsuite/gfortran.dg/pr50392.f | 12 ++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 30ed449e12f..3780d27a9f6 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1673,9 +1673,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) TREE_USED (sym->backend_decl) = 1; if (sym->attr.assign && GFC_DECL_ASSIGN (sym->backend_decl) == 0) - { - gfc_add_assign_aux_vars (sym); - } + gfc_add_assign_aux_vars (sym); if ((sym->attr.dimension || IS_CLASS_ARRAY (sym)) && DECL_LANG_SPECIFIC (sym->backend_decl) @@ -1689,6 +1687,10 @@ gfc_get_symbol_decl (gfc_symbol * sym) return sym->backend_decl; } + if (sym->result == sym && sym->attr.assign + && GFC_DECL_ASSIGN (sym->backend_decl) == 0) + gfc_add_assign_aux_vars (sym); + if (sym->backend_decl) return sym->backend_decl; @@ -3142,6 +3144,9 @@ gfc_get_fake_result_decl (gfc_symbol * sym, int parent_flag) else current_fake_result_decl = build_tree_list (NULL, decl); + if (sym->attr.assign) + DECL_LANG_SPECIFIC (decl) = DECL_LANG_SPECIFIC (sym->backend_decl); + return decl; } diff --git a/gcc/testsuite/gfortran.dg/pr50392.f b/gcc/testsuite/gfortran.dg/pr50392.f new file mode 100644 index 00000000000..2cb883e41a3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr50392.f @@ -0,0 +1,12 @@ +! { dg-do compile } +! + function kf() + integer kf + assign 1 to kf ! { dg-warning "Deleted feature: ASSIGN statement at" } + kf = 2 + goto kf ! { dg-warning "Deleted feature: Assigned GOTO statement at" } + kf = 1 + 1 continue + kf = 0 + end +
reply other threads:[~2020-09-17 17:04 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200917170426.EA6CB398792C@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@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).