Use ODR for canonical types construction in LTO

Christophe Lyon christophe.lyon@linaro.org
Tue Jun 25 12:29:00 GMT 2019


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

> Honza
> >
> > --
> > Eric Botcazou
>
> > Index: gcc-interface/decl.c
> > ===================================================================
> > --- gcc-interface/decl.c      (revision 272633)
> > +++ gcc-interface/decl.c      (working copy)
> > @@ -1855,8 +1855,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
> >         = Has_Biased_Representation (gnat_entity);
> >
> >        /* Do the same processing for Character subtypes as for types.  */
> > -      if ((TREE_CODE (TREE_TYPE (gnu_type)) == INTEGER_TYPE
> > -        || TREE_CODE (TREE_TYPE (gnu_type)) == ARRAY_TYPE)
> > +      if (TREE_CODE (TREE_TYPE (gnu_type)) == INTEGER_TYPE
> >         && TYPE_STRING_FLAG (TREE_TYPE (gnu_type)))
> >       {
> >         TYPE_NAME (gnu_type) = gnu_entity_name;
> > Index: gcc-interface/gigi.h
> > ===================================================================
> > --- gcc-interface/gigi.h      (revision 272633)
> > +++ gcc-interface/gigi.h      (working copy)
> > @@ -1139,7 +1139,8 @@ static inline tree
> >  maybe_character_type (tree type)
> >  {
> >    if (TREE_CODE (type) == INTEGER_TYPE
> > -      && TYPE_STRING_FLAG (type) && !TYPE_UNSIGNED (type))
> > +      && TYPE_STRING_FLAG (type)
> > +      && !TYPE_UNSIGNED (type))
> >      type = gnat_unsigned_type_for (type);
> >
> >    return type;
> > @@ -1153,7 +1154,8 @@ maybe_character_value (tree expr)
> >    tree type = TREE_TYPE (expr);
> >
> >    if (TREE_CODE (type) == INTEGER_TYPE
> > -      && TYPE_STRING_FLAG (type) && !TYPE_UNSIGNED (type))
> > +      && TYPE_STRING_FLAG (type)
> > +      && !TYPE_UNSIGNED (type))
> >      {
> >        type = gnat_unsigned_type_for (type);
> >        expr = convert (type, expr);
>



More information about the Gcc-patches mailing list