On Mon, 24 Jun 2019, Jan Hubicka wrote:

> > Hi,
> > here is patch that adds TYPE_ODR_P to determine type that comply C++
> > ODR rules (i.e. ODR types themselves or structures/unions derived
> > from them).
> > I have decided to use STRING_FLAG which have meaning only for integers
> > and arrays which forced me to add type checks on places where
> > we check STRING_FLAG on other types.
> > 
> > The patch also let me to verify that all types we consider to have
> > linkage actually are created by C++ FE which turned out to not be the
> > case for Ada which I fixed in needs_assembler_name_p.
> > 
> > Bootstrapped/regtested x86_64-linux, OK?
> > 
> >     * ipa-utils.h (type_with_linkage_p): Verify that type is
> >     CXX_ODR_P.
> >     (odr_type_p): Remove extra return.
> >     * lto-streamer-out.c (hash_tree): Hash TYPE_CXX_ODR_P;
> >     hash STRING_FLAG only for arrays and integers.
> >     * tree-stremaer-in.c (unpack_ts_type_common_value_fields):
> >     Update analogously.
> >     * tree-streamer-out.c (pack_ts_type_common_value_fields):
> >     Likewise.
> >     * print-tree.c (print_node): Print cxx-odr-p
> >     and string-flag.
> >     * tree.c (need_assembler_name_p): Also check that type
> >     is CXX_ODR_TYPE_P
> >     (verify_type_variant): Update verification of SRING_FLAG;
> >     also check CXX_ODR_P.
> >     * tree.h (ARRAY_OR_INTEGER_TYPE_CHECK): New macro.
> >     (TYPE_STRING_FLAG): Use it.
> >     (TYPE_CXX_ODR_P): New macro.
> > 
> >     * lto-common.c (compare_tree_sccs_1): Compare CXX_ODR_P;
> >     compare STRING_FLAG only for arrays and integers.
> > 
> >     * gcc-interface/decl.c (gnat_to_gnu_entity): Check that
> >     type is array or integer prior checking string flag.
> >     * gcc-interface/gigi.h (gnat_signed_type_for,
> >     maybe_character_value): Likewise.
> > 
> >     * c-common.c (braced_lists_to_strings): Check that
> >     type is array or integer prior checking string flag.
> > 
> >     * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
> > 
> >     * dwarf2out.c (gen_array_type_die): First check that type
> >     is an array and then test string flag.
> > 
> >     * trans-expr.c (gfc_conv_substring): Check that
> >     type is array or integer prior checking string flag.
> >     (gfc_conv_string_parameter): Likewise.
> >     * trans-openmp.c (gfc_omp_scalar_p): Likewise.
> >     * trans.c (gfc_build_array_ref): Likewise.
> 
> Hi,
> I would like to ping the patch - if it makes sense updating the original
> ODR patch should be easy.

Yes, this patch is OK if you amend the string_flag declaration in
tree-core.h with a comment explaining the uses on the two different
type classes.

Btw, I still wonder what the ODR says in the face of language
inter-operation and what this means here?  For C++ I suppose PODs
are not ODR?

Thanks,
Richard.

Reply via email to