public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
@ 2020-11-20 10:55 doko at debian dot org
  2020-11-20 10:58 ` [Bug fortran/97927] " jakub at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: doko at debian dot org @ 2020-11-20 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97927
           Summary: gfortran: ICE in lookup_field_for_decl, at
                    tree-nested.c:288
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at debian dot org
  Target Milestone: ---

[forwarded from https://bugs.debian.org/975219]

seen building elkcode-6.3.2 on x86_74-linux-gnu
gcc-10 branch, compiler configured with -enable-checking=yes,extra,rtl, didn't
check the trunk yet.

I can reproduce this locally, replacing mpif90 with gfortran. I'm failing to
construct a test case outside the build directory.

$ cd src; gfortran -c -fopenmp exxengy.f90
exxengy.f90:6:18:

    6 | subroutine exxengy
      |                  ^
internal compiler error: in lookup_field_for_decl, at tree-nested.c:288
0x71106d lookup_field_for_decl
        ../../src/gcc/tree-nested.c:288
0x111523e convert_local_reference_stmt
        ../../src/gcc/tree-nested.c:2408
0xd82a5a walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:578
0xd82c20 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:51
0xd82b11 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:686
0xd82c20 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:51
0xd82b11 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:686
0xd82c20 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:51
0xd82b51 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:641
0xd82c20 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:51
0xd82b51 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:641
0xd82c20 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:51
0xd82b11 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:686
0xd82c20 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../src/gcc/gimple-walk.c:51
0x110d154 walk_body
        ../../src/gcc/tree-nested.c:713
0x110d154 walk_function
        ../../src/gcc/tree-nested.c:724
0x110d154 walk_all_functions
        ../../src/gcc/tree-nested.c:789
0x111360a lower_nested_functions(tree_node*)
        ../../src/gcc/tree-nested.c:3580
0xbe8e4c cgraph_node::analyze()
        ../../src/gcc/cgraphunit.c:676
0xbec017 analyze_functions
        ../../src/gcc/cgraphunit.c:1227
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
@ 2020-11-20 10:58 ` jakub at gcc dot gnu.org
  2020-11-20 11:03 ` doko at debian dot org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-11-20 10:58 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Can you attach the source (or, if it uses modules also sources of the modules
it uses)?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 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
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: doko at debian dot org @ 2020-11-20 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Matthias Klose <doko at debian dot org> ---
Created attachment 49605
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49605&action=edit
test case

that's my unsuccessful extraction attempt

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 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
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-11-20 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-11-20
             Status|UNCONFIRMED                 |WAITING

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Works for me with 10.2.0 and trunk r11-5181.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (2 preceding siblings ...)
  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
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: doko at debian dot org @ 2020-11-20 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Matthias Klose <doko at debian dot org> ---
Dominique, are your compilers configured with --enable-checking=yes,extra,rtl ?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (3 preceding siblings ...)
  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
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-11-20 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Dominique, are your compilers configured with --enable-checking=yes,extra,rtl ?

Only --enable-checking=yes (the default for experimental).

My instrumented compiler r11-5060 also works.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (4 preceding siblings ...)
  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
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: doko at debian dot org @ 2020-11-20 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Matthias Klose <doko at debian dot org> ---
just checked with today's trunk and --enable-checking=yes,extra,rtl
working there.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (5 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-11-21 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
>just checked with today's trunk and --enable-checking=yes,extra,rtl
> working there.

What was the failing version?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (6 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-11-23 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Can't reproduce with 20201005 10 branch or current trunk.
The 10 branch changed tree-nested.c e.g. in r10-8663, but I don't really see
any linear, lastprivate or reduction clauses in this.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (7 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-11-24 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #8)
> Can't reproduce with 20201005 10 branch or current trunk.

Neither I with yesterday's trunk and today's GCC 10
(8c8c5aae6b462d2df38f21f76c01d89d2f79f099)
It also does not crash on GCC 10 with ede01bd9adf55f43598036d21d5db3d95dfd24a3
(= Wed Aug 26) nor with c0746a1beb1ba073c7981eb09f55b3d993b32e5c (= Aug 25).

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (8 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: doko at debian dot org @ 2021-03-05 12:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Matthias Klose <doko at debian dot org> ---
seen again with 20210227

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (9 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: doko at debian dot org @ 2021-03-05 13:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Matthias Klose <doko at debian dot org> ---
20210227 trunk

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (10 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-03-05 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Matthias Klose from comment #10)
> seen again with 20210227

I tried it with the attached file and the build.sh but calling gfortran
directly w/o mpif90 wrapper.

That's with --enable-checking=yes,extra,rtl and:
mainline: 4d66685e49d20e0c7a87c5fa0757c7eb63ffcdaa (Fri Mar 5 05:25:54 2021
-0800)
GCC 10: c85c24099b28f7af907466af2c1b73da9455368c (Fri Mar 5 12:45:41 2021
+0100)

That's on x86_64-gnu-linux (Ubuntu 14.04.4 LTS).

It did compile without any problems; I also tried running it with valgrind and
did not spot anything there, either.

Looking at the Elk webpage, also no gfortran-related issues are reported
threre.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (11 preceding siblings ...)
  2021-03-05 13:51 ` burnus at gcc dot gnu.org
@ 2021-03-05 18:56 ` burnus at gcc dot gnu.org
  2021-03-05 19:08 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-03-05 18:56 UTC (permalink / raw)
  To: gcc-bugs

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?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (12 preceding siblings ...)
  2021-03-05 18:56 ` burnus at gcc dot gnu.org
@ 2021-03-05 19:08 ` burnus at gcc dot gnu.org
  2021-03-06 10:13 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-03-05 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #14 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #13)
>  <var_decl 0x7ffff7ffbab0 ierror
...
>     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?

The following compiles – but I don't know whether it makes sense:


--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -382,7 +382,8 @@ static tree
 lookup_field_for_decl (struct nesting_info *info, tree decl,
                       enum insert_option insert)
 {
-  gcc_checking_assert (decl_function_context (decl) == info->context);
+  gcc_checking_assert (TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL
+                      || decl_function_context (decl) == info->context);

   if (insert == NO_INSERT)
     {

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (13 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-03-06 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566366.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (14 preceding siblings ...)
  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
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-08 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:8a6a62614a8ae4544770420416d1632d6c3d3f6e

commit r11-7551-g8a6a62614a8ae4544770420416d1632d6c3d3f6e
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Mar 8 13:05:48 2021 +0100

    tree-nested: Update assert for Fortran module vars [PR97927]

    gcc/ChangeLog:

            PR fortran/97927
            * tree-nested.c (convert_local_reference_stmt): Avoid calling
            lookup_field_for_decl for Fortran module (= namespace context).

    gcc/testsuite/ChangeLog:

            PR fortran/97927
            * gfortran.dg/module_variable_3.f90: New test.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (15 preceding siblings ...)
  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
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-15 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Tobias Burnus
<burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:a14691e924ea4a8277ea36df08b2f5359082bf62

commit r10-9444-ga14691e924ea4a8277ea36df08b2f5359082bf62
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Mar 8 13:05:48 2021 +0100

    tree-nested: Update assert for Fortran module vars [PR97927]

    gcc/ChangeLog:

            PR fortran/97927
            * tree-nested.c (convert_local_reference_stmt): Avoid calling
            lookup_field_for_decl for Fortran module (= namespace context).

    gcc/testsuite/ChangeLog:

            PR fortran/97927
            * gfortran.dg/module_variable_3.f90: New test.

    (cherry picked from commit 8a6a62614a8ae4544770420416d1632d6c3d3f6e)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug fortran/97927] gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288
  2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 doko at debian dot org
                   ` (16 preceding siblings ...)
  2021-03-15 14:44 ` cvs-commit at gcc dot gnu.org
@ 2021-03-15 14:46 ` burnus at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-03-15 14:46 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #18 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Finally reduced and, hence, finally
FIXED – on mainline (GCC 11) and GCC 10.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-03-15 14:46 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 10:55 [Bug fortran/97927] New: gfortran: ICE in lookup_field_for_decl, at tree-nested.c:288 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
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

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).