This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Silence merge warnings on artificial types


On Tue, Mar 31, 2015 at 09:51:21 +0200, Jan Hubicka wrote:
> this patch adds the ARTIFICIAL flag check to avoid ODR merging to these.
> I oriignally tested DECL_ARTIFICIAL (decl) (that is TYPE_NAME) that randomly
> dropped type names on some classes but not all.
> 
> Jason, please do you know what is meaning of DECL_ARTIFICIAL on class type
> names? Perhaps we can drop them to 0 in free lang data?
> 
> With this bug I triggered wrong devirtualization because we no longer insert
> non-odr types into a type inheritance graph.  This is fixed by the lto_read_decls
> change and finally I triggered an ICE in ipa-devirt that due to the bug
> output a warning late and ICEd on streamer cache being NULL.  I guess it is
> better to guard it even though all wanrings should be output early.
> 
> Bootsrapped/regtested x86_64-linux, will commit it after chromium rebuild.
> 
> Honza
> 
> 	* tree.c (need_assembler_name_p): Artificial types have no ODR
> 	names.
> 	* ipa-devirt.c (warn_odr): Do not try to apply ODR cache when
> 	no caching is done.
> 
> 	* lto.c (lto_read_decls): Move code registering odr types out
> 	of TYPE_CANONICAL conditional and also register polymorphic types.
> Index: tree.c
> ===================================================================
> --- tree.c	(revision 221777)
> @@ -5139,6 +5145,7 @@ need_assembler_name_p (tree decl)
>        && decl == TYPE_NAME (TREE_TYPE (decl))
>        && !is_lang_specific (TREE_TYPE (decl))
>        && AGGREGATE_TYPE_P (TREE_TYPE (decl))
> +      && !TYPE_ARTIFICIAL (TREE_TYPE (decl))
>        && !variably_modified_type_p (TREE_TYPE (decl), NULL_TREE)
>        && !type_in_anonymous_namespace_p (TREE_TYPE (decl)))
>      return !DECL_ASSEMBLER_NAME_SET_P (decl);

Hmm, libgomp.c++/target-3.C still fails.
Here is what I see in need_assembler_name_p:

 <type_decl 0x2b5a8751aed8 .omp_data_s.3
    type <record_type 0x2b5a87536690 .omp_data_s.3 BLK
        size <integer_cst 0x2b5a873ce318 constant 192>
        unit size <integer_cst 0x2b5a873ce2e8 constant 24>
        align 64 symtab 0 alias set -1 canonical type 0x2b5a87536690
        fields <field_decl 0x2b5a87537000 b.0 type <pointer_type 0x2b5a87536150>
            unsigned DI file test.cpp line 8 col 13
            size <integer_cst 0x2b5a873ace58 constant 64>
            unit size <integer_cst 0x2b5a873ace70 constant 8>
            align 64 offset_align 128
            offset <integer_cst 0x2b5a873ace88 constant 0>
            bit offset <integer_cst 0x2b5a873aced0 constant 0> context <record_type 0x2b5a87536690 .omp_data_s.3> chain <field_decl 0x2b5a87537098 s>> reference_to_this <reference_type 0x2b5a87536738>>
    VOID file test.cpp line 11 col 13
    align 1>
(TYPE_ARTIFICIAL = 0)

 <type_decl 0x2b5a8751a850 .omp_data_s.3
    type <record_type 0x2b5a8752cdc8 .omp_data_s.3 BLK
        size <integer_cst 0x2b5a873ce318 constant 192>
        unit size <integer_cst 0x2b5a873ce2e8 constant 24>
        align 64 symtab 0 alias set -1 canonical type 0x2b5a8752cdc8
        fields <field_decl 0x2b5a8751a980 b.0 type <pointer_type 0x2b5a8752c498>
            unsigned DI file test.cpp line 8 col 13
            size <integer_cst 0x2b5a873ace58 constant 64>
            unit size <integer_cst 0x2b5a873ace70 constant 8>
            align 64 offset_align 128
            offset <integer_cst 0x2b5a873ace88 constant 0>
            bit offset <integer_cst 0x2b5a873aced0 constant 0> context <record_type 0x2b5a8752cdc8 .omp_data_s.3> chain <field_decl 0x2b5a8751a8e8 s>>
        pointer_to_this <pointer_type 0x2b5a87536888>>
    VOID file test.cpp line 11 col 13
    align 1>
(TYPE_ARTIFICIAL = 0)

  -- Ilya


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]