Bug 96737 - ICE when compiling module and submodule in same file with debug (-g)
Summary: ICE when compiling module and submodule in same file with debug (-g)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-21 17:00 UTC by Andre Vehreschild
Modified: 2020-08-23 14:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-08-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Vehreschild 2020-08-21 17:00:27 UTC
Latest gfortran ICE with:
   35 | end module
      | 
Error: 'TYPE_CANONICAL' is not compatible
 <record_type 0x7f1324fef000 surfaces asm_written BLK
    size <integer_cst 0x7f1324fde2d0 type <integer_type 0x7f1324e100a8 bitsizetype> constant 960>
    unit-size <integer_cst 0x7f1324fde228 type <integer_type 0x7f1324e10000 sizetype> constant 120>
    align:64 warn_if_not_align:0 symtab:620683744 alias-set -1 canonical-type 0x7f1324fef000
    fields <field_decl 0x7f1324ff0720 halo_outbox
        type <record_type 0x7f1324fef2a0 array03_package asm_written type_1 BLK size <integer_cst 0x7f1324fde2d0 960> unit-size <integer_cst 0x7f1324fde228 120>
            align:64 warn_if_not_align:0 symtab:620683824 alias-set -1 canonical-type 0x7f1324fef348 fields <field_decl 0x7f1324fe8ed8 data>
            pointer_to_this <pointer_type 0x7f1324fef738> chain <type_decl 0x7f1324ff0688 D.4057>>
        BLK ../build-gcc/opencoarrays/intel-18-works-onefile.f90:35:10 size <integer_cst 0x7f1324fde2d0 960> unit-size <integer_cst 0x7f1324fde228 120>
        align:64 warn_if_not_align:0 offset_align 128
        offset <integer_cst 0x7f1324dfbbe8 constant 0>
        bit-offset <integer_cst 0x7f1324dfbc30 constant 0> context <record_type 0x7f1324fef000 surfaces>> context <namespace_decl 0x7f1324fd81c8 surface_packages>
    pointer_to_this <pointer_type 0x7f1324be3888> reference_to_this <reference_type 0x7f1324be8348> chain <type_decl 0x7f1324ff07b8 D.4059>>
 <record_type 0x7f1324c2c930 surfaces BLK
    size <integer_cst 0x7f1324fde198 type <integer_type 0x7f1324e100a8 bitsizetype> constant 1152>
    unit-size <integer_cst 0x7f1324fc2528 type <integer_type 0x7f1324e10000 sizetype> constant 144>
    align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f1324fef000
    fields <field_decl 0x7f1324c2dd10 halo_outbox
        type <record_type 0x7f1324c2c2a0 array04_package type_1 BLK size <integer_cst 0x7f1324fde198 1152> unit-size <integer_cst 0x7f1324fc2528 144>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f1324c2c498 fields <field_decl 0x7f1324c2d558 data>
            pointer_to_this <pointer_type 0x7f1324c2cd20> chain <type_decl 0x7f1324c2dc78 D.4549>>
        BLK ../build-gcc/opencoarrays/intel-18-works-onefile.f90:64:13 size <integer_cst 0x7f1324fde198 1152> unit-size <integer_cst 0x7f1324fc2528 144>
        align:64 warn_if_not_align:0 offset_align 128
        offset <integer_cst 0x7f1324dfbbe8 constant 0>
        bit-offset <integer_cst 0x7f1324dfbc30 constant 0> context <record_type 0x7f1324c2c930 surfaces>>
    chain <type_decl 0x7f1324c2dda8 D.4551>>
../build-gcc/opencoarrays/intel-18-works-onefile.f90:35:0: internal compiler error: 'verify_type' failed
0x17b70de verify_type(tree_node const*)
	/home/vehre/Projekte/gcc/gcc.orig/gcc/tree.c:14744
0xd38de7 gen_type_die_with_usage
	/home/vehre/Projekte/gcc/gcc.orig/gcc/dwarf2out.c:25500
0xd39a1a gen_type_die
	/home/vehre/Projekte/gcc/gcc.orig/gcc/dwarf2out.c:25730
0xd3b95b gen_decl_die
	/home/vehre/Projekte/gcc/gcc.orig/gcc/dwarf2out.c:26362
0xd3ce96 dwarf2out_decl
	/home/vehre/Projekte/gcc/gcc.orig/gcc/dwarf2out.c:26910
0xd3c2f9 dwarf2out_type_decl
	/home/vehre/Projekte/gcc/gcc.orig/gcc/dwarf2out.c:26635
0x11b6fa3 rest_of_type_compilation(tree_node*, int)
	/home/vehre/Projekte/gcc/gcc.orig/gcc/passes.c:339
0xb70435 gfc_finish_type(tree_node*)
	/home/vehre/Projekte/gcc/gcc.orig/gcc/fortran/trans-types.c:2327
0xb71ce0 gfc_get_derived_type(gfc_symbol*, int)
	/home/vehre/Projekte/gcc/gcc.orig/gcc/fortran/trans-types.c:2812
0xb6c943 gfc_typenode_for_spec(gfc_typespec*, int)
	/home/vehre/Projekte/gcc/gcc.orig/gcc/fortran/trans-types.c:1166
0xb700ce gfc_sym_type(gfc_symbol*)
	/home/vehre/Projekte/gcc/gcc.orig/gcc/fortran/trans-types.c:2247
0xac977d gfc_get_symbol_decl(gfc_symbol*)
	/home/vehre/Projekte/gcc/gcc.orig/gcc/fortran/trans-decl.c:1769
0xad70b2 gfc_create_module_variable
	/home/vehre/Projekte/gcc/gcc.orig/gcc/fortran/trans-decl.c:5307

when compiling the example from:

https://github.com/sourceryinstitute/AdHoc/blob/master/src/gnu/nrc/coarray-with-nested-allocatable-components/intel-18-works.f90
Comment 1 Dominique d'Humieres 2020-08-21 17:08:11 UTC
This seems fixed on GCC11.
Comment 2 Dominique d'Humieres 2020-08-22 19:15:12 UTC
I see the error if I compile the test with -g.
Comment 3 Andre Vehreschild 2020-08-23 14:23:47 UTC
Sorry, I was in a hurry to post the pr. You're right one needs to specify '-g' to see the issue.
Comment 4 GCC Commits 2020-08-23 14:34:37 UTC
The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

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

commit r11-2809-gc4565031c8dc6b5289e36553e5cd937a91825953
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Sun Aug 23 15:34:27 2020 +0100

    This patch fixes PR96737. See the explanatory comment in the testcase.
    
    2020-08-23  Paul Thomas  <pault@gcc.gnu.org>
    
    gcc/fortran
            PR fortran/96737
            * trans-types.c (gfc_get_derived_type): Derived types that are
            used in submodules are not compatible with TYPE_CANONICAL from
            any of the global namespaces.
    
    gcc/testsuite/
            PR fortran/96737
            * gfortran.dg/pr96737.f90: New test.
Comment 5 GCC Commits 2020-08-23 14:37:30 UTC
The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:967454a212c7693577a1911e637c3f9f3edc7ccf

commit r11-2810-g967454a212c7693577a1911e637c3f9f3edc7ccf
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Sun Aug 23 15:37:21 2020 +0100

    Adding option -g to pr96737.f90.
    
    2020-08-23  Paul Thomas  <pault@gcc.gnu.org>
    
    gcc/testsuite/
            PR fortran/96737
            * gfortran.dg/pr96737.f90: Add option -g.
Comment 6 Paul Thomas 2020-08-23 14:39:34 UTC
(In reply to CVS Commits from comment #5)
> The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:967454a212c7693577a1911e637c3f9f3edc7ccf
> 
> commit r11-2810-g967454a212c7693577a1911e637c3f9f3edc7ccf
> Author: Paul Thomas <pault@gcc.gnu.org>
> Date:   Sun Aug 23 15:37:21 2020 +0100
> 
>     Adding option -g to pr96737.f90.
>     
>     2020-08-23  Paul Thomas  <pault@gcc.gnu.org>
>     
>     gcc/testsuite/
>             PR fortran/96737
>             * gfortran.dg/pr96737.f90: Add option -g.

Duuh! I forgot the -g too!

Closing.

Paul