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: Bare bones of type verifier


On April 28, 2015 6:01:24 PM GMT+02:00, Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:
>On April 28, 2015 11:05:44 AM GMT+02:00, Jan Hubicka <hubicka@ucw.cz>
>wrote:
>>Hi,
>>I will fix the free count issue - my internet access in China was bit
>>sporadic
>>and I hoped you will know why the count seem to disagree between PPC64
>>and Linux
>>builds. In meantime PPC64 stopped to build for me.
>>> 
>>> (early) dwarf2out is a good place, likewise verifying right after 
>>> free-lang-data.  I agree that LTO type merging is also a good place.
>>> 
>>> I hope we get early dwarf2out merged soon and can enable
>>free-lang-data
>>> also for non-LTO compilation.
>>> 
>>> > LTO-Boostrapped/regtested x86_64-linux without Ada. I am doing
>full
>>run on
>>> > PPC64, but it fails on unrelated libgmp miscomplation I proably
>>need to track down
>>> > first.
>>> > 
>>> > OK if testing passes?
>>> 
>>> Please make sure to test _all_ languages (all,ada,obj-c++,go) and
>>also
>>> include multilibs in testing (thus -m64/-m32).
>>> 
>>> You don't verify that TYPE_CANONICAL is consistent nor that
>>TYPE_CANONICAL
>>> doesn't form a tree (TYPE_CANONICAL (t) == TYPE_CANONICAL
>>(TYPE_CANONICAL 
>>> (t))).
>>
>>Yep, I have this one in queue, but of course it fires, thus it is not
>>in the initial patch.
>>> > +#ifdef ENABLE_CHECKING
>>> > +  verify_type (expr);
>>> > +#endif
>>> 
>>> As said I think that doing this after free-lang-data is better. 
>Like
>>> here:
>>> 
>>>   /* Traverse every type found freeing its language data.  */
>>>   FOR_EACH_VEC_ELT (fld.types, i, t)
>>>     free_lang_data_in_type (t);
>>> 
>>> do another loop verifying types.
>>
>>OK, we however build new types in middle end
>>(ipa-icf/ipa-split/ipa-sra),
>>so perhaps we can check on both places?
>>> 
>>> >    stream_write_tree (ob, TYPE_SIZE (expr), ref_p);
>>> >    stream_write_tree (ob, TYPE_SIZE_UNIT (expr), ref_p);
>>> >    stream_write_tree (ob, TYPE_ATTRIBUTES (expr), ref_p);
>>> > Index: dwarf2out.c
>>> >
>===================================================================
>>> > --- dwarf2out.c	(revision 222391)
>>> > +++ dwarf2out.c	(working copy)
>>> > @@ -21264,6 +21264,11 @@ dwarf2out_decl (tree decl)
>>> >  {
>>> >    dw_die_ref context_die = comp_unit_die ();
>>> >  
>>> > +#ifdef ENABLE_CHECKING
>>> > +  if (TREE_TYPE (decl))
>>> > +     verify_type (TREE_TYPE (decl));
>>> > +#endif
>>> > +
>>> 
>>> Hmm, this has the chance to verify types multiple times, no? 
>>Wouldn't
>>> gen_type_die_with_usage be a better place to verify the type we
>>create
>>> the DIE for?
>>
>>That looks better indeed.  The checks are not paritcularly expensive
>>though.
>
>+ if (((TREE_CODE (t) == ENUMERAL_TYPE && COMPLETE_TYPE_P (t))
>+	|| TREE_CODE (t) == INTEGER_TYPE
>+	|| TREE_CODE (t) == BOOLEAN_TYPE
>+	|| TREE_CODE (t) == REAL_TYPE
>+	|| TREE_CODE (t) == FIXED_POINT_TYPE)
>+ && (TYPE_MAX_VALUE (t) != TYPE_MAX_VALUE (tv)
>+	 || TYPE_MAX_VALUE (t) != TYPE_MAX_VALUE (tv)))
>+ {
>+ error ("type variant has different TYPE_MIN_VALUE");
>+ debug_tree (tv);
>+ return false;
>+ }
>
>The second || check of TYPE_MAX_VALUE should probably be something
>else, maybe TYPE_MIN_VALUE ?
>
>Why don't we warn about such useless || where both hands are identical?
>:)

Also: s/TYPE_MAIN_VARAINT/TYPE_MAIN_VARIANT/g
Thanks,


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