public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
Date: Fri, 05 Mar 2021 18:56:27 +0000	[thread overview]
Message-ID: <bug-97927-4-tfo4rxGMgo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97927-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #13 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 50313
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50313&action=edit
Reduced testcase - run with 'gfortran file.f90' (seems to require
--enable-checking=yes)

The generated code has:

__attribute__((fn spec (". ")))
void zrho2 ()   // <<--- nested in exxengy
{
  return;
}

__attribute__((fn spec (". ")))
void exxengy ()
{
  static void zrho2 (void);

  ierror = {CLOBBER};
  mpi_allreduce (&ierror);
}


ICE: In tree-nested.c's convert_local_reference_stmt, there is:

2524        case GIMPLE_ASSIGN:
2525          if (gimple_clobber_p (stmt))
2526            {
2527              tree lhs = gimple_assign_lhs (stmt);
2528              if (DECL_P (lhs)
2529                  && !use_pointer_in_frame (lhs)
2530                  && lookup_field_for_decl (info, lhs, NO_INSERT))

with:

(gdb) p debug_gimple_seq(*gsi->seq)
ierror = {CLOBBER};
mpi_allreduce (&ierror);

and lhs == decl in the following:

#0  lookup_field_for_decl (info=0x2f28150, decl=0x7ffff7ffbab0,
insert=NO_INSERT) at ../../repos/gcc/gcc/tree-nested.c:385
385       gcc_checking_assert (decl_function_context (decl) == info->context);

with

(gdb) p debug_tree(info->context)
 <function_decl 0x7ffff7668200 exxengy

and

(gdb) p decl_function_context (decl)
$3 = (tree_node *) 0x0

(gdb) p debug_tree(decl)
 <var_decl 0x7ffff7ffbab0 ierror
    type <integer_type 0x7ffff74a95e8 integer(kind=4) public SI
        size <integer_cst 0x7ffff7494df8 constant 32>
        unit-size <integer_cst 0x7ffff7494e10 constant 4>
        align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff74a95e8 precision:32 min <integer_cst 0x7ffff7494db0 -2147483648> max
<integer_cst 0x7ffff7494dc8 2147483647>
        pointer_to_this <pointer_type 0x7ffff74b09d8>>
    addressable used public static SI exxengy4.f90:12:16 size <integer_cst
0x7ffff7494df8 32> unit-size <integer_cst 0x7ffff7494e10 4>
    align:32 warn_if_not_align:0 context <namespace_decl 0x7ffff7667260 modmpi>
chain <function_decl 0x7ffff7668200 exxengy>>


I am not quite sure whether the context is right or not:
  context <namespace_decl 0x7ffff7667260 modmpi> 
but it does not really look wrong, does it?

  parent reply	other threads:[~2021-03-05 18:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 10:55 [Bug fortran/97927] New: " doko at debian dot org
2020-11-20 10:58 ` [Bug fortran/97927] " jakub at gcc dot gnu.org
2020-11-20 11:03 ` doko at debian dot org
2020-11-20 14:20 ` dominiq at lps dot ens.fr
2020-11-20 14:22 ` doko at debian dot org
2020-11-20 14:35 ` dominiq at lps dot ens.fr
2020-11-20 14:53 ` doko at debian dot org
2020-11-21 17:22 ` dominiq at lps dot ens.fr
2020-11-23 18:32 ` jakub at gcc dot gnu.org
2020-11-24 12:09 ` burnus at gcc dot gnu.org
2021-03-05 12:04 ` doko at debian dot org
2021-03-05 13:49 ` doko at debian dot org
2021-03-05 13:51 ` burnus at gcc dot gnu.org
2021-03-05 18:56 ` burnus at gcc dot gnu.org [this message]
2021-03-05 19:08 ` burnus at gcc dot gnu.org
2021-03-06 10:13 ` burnus at gcc dot gnu.org
2021-03-08 12:06 ` cvs-commit at gcc dot gnu.org
2021-03-15 14:44 ` cvs-commit at gcc dot gnu.org
2021-03-15 14:46 ` burnus 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-97927-4-tfo4rxGMgo@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).