Use ODR for canonical types construction in LTO

Jan Hubicka hubicka@ucw.cz
Thu Jun 27 06:29:00 GMT 2019


> Hi,
> 
> This commit https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=272628 is breaking trunk LTO on some real benchmarks, so can it be fixed or reverted? For example,

Do you have a testcase?
Honza
> 
> lto1: error: type variant differs by TYPE_CXX_ODR_P
>  <record_type 0xffff99943d08 __va_list BLK
>     size <integer_cst 0xffff99890f60 type <integer_type 0xffff999400a8 bitsizetype> constant 256>
>     unit-size <integer_cst 0xffff99891050 type <integer_type 0xffff99940000 sizetype> constant 32>
>     align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0xffff99943d08
>     fields <field_decl 0xffff99960130 __stack
>         type <pointer_type 0xffff99940fc0 type <void_type 0xffff99940f18 void>
>             public unsigned DI
>             size <integer_cst 0xffff99890c00 constant 64>
>             unit-size <integer_cst 0xffff99890c18 constant 8>
>             align:64 warn_if_not_align:0 symtab:0 alias-set 7 structural-equality
>             pointer_to_this <pointer_type 0xffff99b5d740>>
>         unsigned DI <built-in>:0:0 size <integer_cst 0xffff99890c00 64> unit-size <integer_cst 0xffff99890c18 8>
>         align:64 warn_if_not_align:0 offset_align 128
>         offset <integer_cst 0xffff99890c30 constant 0>
>         bit-offset <integer_cst 0xffff99890c78 constant 0> context <record_type 0xffff99943d08 __va_list>
>         chain <field_decl 0xffff999601c8 __gr_top type <pointer_type 0xffff99940fc0>
>             unsigned DI <built-in>:0:0 size <integer_cst 0xffff99890c00 64> unit-size <integer_cst 0xffff99890c18 8>
>             align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst 0xffff99890c30 0> bit-offset <integer_cst 0xffff99890c00 64> context <record_type 0xffff99943d08 __va_list> chain <field_decl 0xffff99960260 __vr_top>>>
>     reference_to_this <reference_type 0xffff99943fa8> chain <type_decl 0xffff99960098 __va_list>>
>  <record_type 0xffff99c59cd8 va_list cxx-odr-p BLK
>     size <integer_cst 0xffff99890f60 type <integer_type 0xffff999400a8 bitsizetype> constant 256>
>     unit-size <integer_cst 0xffff99891050 type <integer_type 0xffff99940000 sizetype> constant 32>
>     align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0xffff99943d08
>     fields <field_decl 0xffff99960130 __stack
>         type <pointer_type 0xffff99940fc0 type <void_type 0xffff99940f18 void>
>             public unsigned DI
>             size <integer_cst 0xffff99890c00 constant 64>
>             unit-size <integer_cst 0xffff99890c18 constant 8>
>             align:64 warn_if_not_align:0 symtab:0 alias-set 7 structural-equality
>             pointer_to_this <pointer_type 0xffff99b5d740>>
>         unsigned DI <built-in>:0:0 size <integer_cst 0xffff99890c00 64> unit-size <integer_cst 0xffff99890c18 8>
>         align:64 warn_if_not_align:0 offset_align 128
>         offset <integer_cst 0xffff99890c30 constant 0>
>         bit-offset <integer_cst 0xffff99890c78 constant 0> context <record_type 0xffff99943d08 __va_list>
>         chain <field_decl 0xffff999601c8 __gr_top type <pointer_type 0xffff99940fc0>
>             unsigned DI <built-in>:0:0 size <integer_cst 0xffff99890c00 64> unit-size <integer_cst 0xffff99890c18 8>
>             align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst 0xffff99890c30 0> bit-offset <integer_cst 0xffff99890c00 64> context <record_type 0xffff99943d08 __va_list> chain <field_decl 0xffff99960260 __vr_top>>>
>     pointer_to_this <pointer_type 0xffff99c59e28> reference_to_this <reference_type 0xffff9a5b0d20>>
> lto1: internal compiler error: 'verify_type' failed
> 0xe33e93 verify_type(tree_node const*)
>         ../../gcc/gcc/tree.c:14655
> 0x5efc4b lto_fixup_state
>         ../../gcc/gcc/lto/lto-common.c:2429
> 0x5fc01b lto_fixup_decls
>         ../../gcc/gcc/lto/lto-common.c:2460
> 0x5fc01b read_cgraph_and_symbols(unsigned int, char const**)
>         ../../gcc/gcc/lto/lto-common.c:2693
> 0x5ded23 lto_main()
>         ../../gcc/gcc/lto/lto.c:616
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <https://gcc.gnu.org/bugs/> for instructions.
> lto-wrapper: fatal error: /home/amptest/gcc/install_last//bin/g++ returned 1 exit status
> compilation terminated.
> /usr/bin/ld: error: lto-wrapper failed
> collect2: error: ld returned 1 exit status
> 
> Thanks,
> -Jiangning
> 
> > -----Original Message-----
> > From: gcc-patches-owner@gcc.gnu.org <gcc-patches-owner@gcc.gnu.org>
> > On Behalf Of Christophe Lyon
> > Sent: Tuesday, June 25, 2019 8:30 PM
> > To: Jan Hubicka <hubicka@ucw.cz>
> > Cc: Eric Botcazou <ebotcazou@adacore.com>; gcc Patches <gcc-
> > patches@gcc.gnu.org>; Richard Biener <rguenther@suse.de>; d@dcepelik.cz;
> > Martin Liška <mliska@suse.cz>
> > Subject: Re: Use ODR for canonical types construction in LTO
> > 
> > Hi,
> > 
> > 
> > On Tue, 25 Jun 2019 at 10:20, Jan Hubicka <hubicka@ucw.cz> wrote:
> > >
> > > > >     * gcc-interface/decl.c (gnat_to_gnu_entity): Check that
> > > > >     type is array or integer prior checking string flag.
> > > >
> > > > The test for array is superfluous here.
> > > >
> > > > >     * gcc-interface/gigi.h (gnat_signed_type_for,
> > > > >     maybe_character_value): Likewise.
> > > >
> > > > Wrong ChangeLog, the first modified function is maybe_character_type.
> > > >
> > > > I have installed the attached patchlet after testing it on x86-64/Linux.
> > > >
> > > >
> > > >       * gcc-interface/decl.c (gnat_to_gnu_entity): Remove superfluous test
> > in
> > > >       previous change.
> > > >       * gcc-interface/gigi.h (maybe_character_type): Fix formatting.
> > > >       (maybe_character_value): Likewise.
> > >
> > > Thanks a lot. I was not quite sure if ARRAY_TYPEs can happen there and
> > > I should have added you to the CC.
> > >
> > 
> > After the main commit (r272628), I have noticed regressions on arm and
> > aarch64:
> > 
> >     g++.dg/lto/pr60336 cp_lto_pr60336_0.o-cp_lto_pr60336_0.o link, -O0 -flto
> > -flto-partition=1to1 -fno-use-linker-plugin  (internal compiler
> > error)
> >     g++.dg/lto/pr60336 cp_lto_pr60336_0.o-cp_lto_pr60336_0.o link, -O0 -flto
> > -flto-partition=none -fuse-linker-plugin (internal compiler
> > error)
> >     g++.dg/lto/pr60336 cp_lto_pr60336_0.o-cp_lto_pr60336_0.o link, -O0 -flto
> > -fuse-linker-plugin -fno-fat-lto-objects  (internal compiler
> > error)
> >     g++.dg/lto/pr60336 cp_lto_pr60336_0.o-cp_lto_pr60336_0.o link, -O2 -flto
> > -flto-partition=1to1 -fno-use-linker-plugin  (internal compiler
> > error)
> >     g++.dg/lto/pr60336 cp_lto_pr60336_0.o-cp_lto_pr60336_0.o link, -O2 -flto
> > -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects (internal compiler
> > error)
> >     g++.dg/lto/pr60336 cp_lto_pr60336_0.o-cp_lto_pr60336_0.o link, -O2 -flto
> > -fuse-linker-plugin (internal compiler error)
> >     g++.dg/torture/pr45843.C   -O2 -flto -fno-use-linker-plugin
> > -flto-partition=none  (internal compiler error)
> >     g++.dg/torture/pr45843.C   -O2 -flto -fuse-linker-plugin
> > -fno-fat-lto-objects  (internal compiler error)
> >     g++.dg/torture/stackalign/eh-vararg-1.C   -O2 -flto
> > -fno-use-linker-plugin -flto-partition=none  (internal compiler error)
> >     g++.dg/torture/stackalign/eh-vararg-1.C   -O2 -flto
> > -fno-use-linker-plugin -flto-partition=none -fpic (internal compiler
> > error)
> >     g++.dg/torture/stackalign/eh-vararg-1.C   -O2 -flto
> > -fuse-linker-plugin -fno-fat-lto-objects  (internal compiler error)
> >     g++.dg/torture/stackalign/eh-vararg-1.C   -O2 -flto
> > -fuse-linker-plugin -fno-fat-lto-objects -fpic (internal compiler
> > error)
> >     g++.dg/torture/stackalign/eh-vararg-2.C   -O2 -flto
> > -fno-use-linker-plugin -flto-partition=none  (internal compiler error)
> >     g++.dg/torture/stackalign/eh-vararg-2.C   -O2 -flto
> > -fno-use-linker-plugin -flto-partition=none -fpic (internal compiler
> > error)
> >     g++.dg/torture/stackalign/eh-vararg-2.C   -O2 -flto
> > -fuse-linker-plugin -fno-fat-lto-objects  (internal compiler error)
> >     g++.dg/torture/stackalign/eh-vararg-2.C   -O2 -flto
> > -fuse-linker-plugin -fno-fat-lto-objects -fpic (internal compiler
> > error)
> > 
> > A sample ICE:
> > lto1: error: type variant differs by TYPE_CXX_ODR_P  <record_type
> > 0x2b3d78275dc8 __va_list BLK
> >     size <integer_cst 0x2b3d7825cf60 type <integer_type 0x2b3d782690a8
> > bitsizetype> constant 256>
> >     unit-size <integer_cst 0x2b3d78270060 type <integer_type
> > 0x2b3d78269000 sizetype> constant 32>
> >     align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
> > 0x2b3d78275dc8
> >     fields <field_decl 0x2b3d78273130 __stack
> >         type <pointer_type 0x2b3d78271000 type <void_type 0x2b3d78269f18
> > void>
> >             public unsigned DI
> >             size <integer_cst 0x2b3d7825cc00 constant 64>
> >             unit-size <integer_cst 0x2b3d7825cc18 constant 8>
> >             align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
> >             pointer_to_this <pointer_type 0x2b3d782769d8>>
> >         unsigned DI <built-in>:0:0 size <integer_cst 0x2b3d7825cc00
> > 64> unit-size <integer_cst 0x2b3d7825cc18 8>
> >         align:64 warn_if_not_align:0 offset_align 128
> >         offset <integer_cst 0x2b3d7825cc30 constant 0>
> >         bit-offset <integer_cst 0x2b3d7825cc78 constant 0> context
> > <record_type 0x2b3d78275dc8 __va_list>
> >         chain <field_decl 0x2b3d782731c8 __gr_top type <pointer_type
> > 0x2b3d78271000>
> >             unsigned DI <built-in>:0:0 size <integer_cst
> > 0x2b3d7825cc00 64> unit-size <integer_cst 0x2b3d7825cc18 8>
> >             align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
> > 0x2b3d7825cc30 0> bit-offset <integer_cst 0x2b3d7825cc00
> > 64> context <record_type 0x2b3d78275dc8 __va_list> chain <field_decl
> > 0x2b3d78273260 __vr_top>>>
> >     reference_to_this <reference_type 0x2b3d782760a8> chain <type_decl
> > 0x2b3d78273098 __va_list>>
> >  <record_type 0x2b3d783f6930 va_list cxx-odr-p BLK
> >     size <integer_cst 0x2b3d7825cf60 type <integer_type 0x2b3d782690a8
> > bitsizetype> constant 256>
> >     unit-size <integer_cst 0x2b3d78270060 type <integer_type
> > 0x2b3d78269000 sizetype> constant 32>
> >     align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
> > 0x2b3d78275dc8
> >     fields <field_decl 0x2b3d78273130 __stack
> >         type <pointer_type 0x2b3d78271000 type <void_type 0x2b3d78269f18
> > void>
> >             public unsigned DI
> >             size <integer_cst 0x2b3d7825cc00 constant 64>
> >             unit-size <integer_cst 0x2b3d7825cc18 constant 8>
> >             align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
> >             pointer_to_this <pointer_type 0x2b3d782769d8>>
> >         unsigned DI <built-in>:0:0 size <integer_cst 0x2b3d7825cc00
> > 64> unit-size <integer_cst 0x2b3d7825cc18 8>
> >         align:64 warn_if_not_align:0 offset_align 128
> >         offset <integer_cst 0x2b3d7825cc30 constant 0>
> >         bit-offset <integer_cst 0x2b3d7825cc78 constant 0> context
> > <record_type 0x2b3d78275dc8 __va_list>
> >         chain <field_decl 0x2b3d782731c8 __gr_top type <pointer_type
> > 0x2b3d78271000>
> >             unsigned DI <built-in>:0:0 size <integer_cst
> > 0x2b3d7825cc00 64> unit-size <integer_cst 0x2b3d7825cc18 8>
> >             align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
> > 0x2b3d7825cc30 0> bit-offset <integer_cst 0x2b3d7825cc00
> > 64> context <record_type 0x2b3d78275dc8 __va_list> chain <field_decl
> > 0x2b3d78273260 __vr_top>>>
> >     pointer_to_this <pointer_type 0x2b3d783f69d8>>
> > lto1: internal compiler error: 'verify_type' failed
> > 0xe667b0 verify_type(tree_node const*)
> >         /gcc/tree.c:14650
> > 0x632cd7 lto_fixup_state
> >         /gcc/lto/lto-common.c:2429
> > 0x63f459 lto_fixup_decls
> >         /gcc/lto/lto-common.c:2460
> > 0x63f459 read_cgraph_and_symbols(unsigned int, char const**)
> >         /gcc/lto/lto-common.c:2693
> > 0x620fa2 lto_main()
> >         /gcc/lto/lto.c:616
> > Please submit a full bug report,
> > 
> > Christophe



More information about the Gcc-patches mailing list