+2019-06-24 Jan Hubicka <jh@suse.cz>
+
+ * 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.
+ * dwarf2out.c (gen_array_type_die): First check that type
+ is an array and then test string flag.
+
2019-06-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/90972
+2019-06-24 Jan Hubicka <jh@suse.cz>
+
+ * 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.
+
2019-06-24 Martin Sebor <msebor@redhat.com>
* gcc-interface/utils.c (handle_nonnull_attribute): Quote attribute
= Has_Biased_Representation (gnat_entity);
/* Do the same processing for Character subtypes as for types. */
- if (TYPE_STRING_FLAG (TREE_TYPE (gnu_type)))
+ if ((TREE_CODE (TREE_TYPE (gnu_type)) == INTEGER_TYPE
+ || TREE_CODE (TREE_TYPE (gnu_type)) == ARRAY_TYPE)
+ && TYPE_STRING_FLAG (TREE_TYPE (gnu_type)))
{
TYPE_NAME (gnu_type) = gnu_entity_name;
TYPE_STRING_FLAG (gnu_type) = 1;
static inline tree
maybe_character_type (tree type)
{
- if (TYPE_STRING_FLAG (type) && !TYPE_UNSIGNED (type))
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_STRING_FLAG (type) && !TYPE_UNSIGNED (type))
type = gnat_unsigned_type_for (type);
return type;
{
tree type = TREE_TYPE (expr);
- if (TYPE_STRING_FLAG (type) && !TYPE_UNSIGNED (type))
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_STRING_FLAG (type) && !TYPE_UNSIGNED (type))
{
type = gnat_unsigned_type_for (type);
expr = convert (type, expr);
+2019-06-24 Jan Hubicka <jh@suse.cz>
+
+ * c-common.c (braced_lists_to_strings): Check that
+ type is array or integer prior checking string flag.
+
2019-06-21 Matthew Beliveau <mbelivea@redhat.com>
PR c++/90875 - added -Wswitch-outside-range option
else
return ctor;
- if (TYPE_STRING_FLAG (ttp))
+ if ((TREE_CODE (ttp) == ARRAY_TYPE || TREE_CODE (ttp) == INTEGER_TYPE)
+ && TYPE_STRING_FLAG (ttp))
return braced_list_to_string (type, ctor);
code = TREE_CODE (ttp);
+2019-06-24 Jan Hubicka <jh@suse.cz>
+
+ * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
+
2019-06-24 Jason Merrill <jason@redhat.com>
* class.c (layout_class_type): Don't use a separate
CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
}
+ if (code == RECORD_TYPE || code == UNION_TYPE)
+ TYPE_CXX_ODR_P (t) = 1;
+
return t;
}
/* Emit DW_TAG_string_type for Fortran character types (with kind 1 only, as
DW_TAG_string_type doesn't have DW_AT_type attribute). */
- if (TYPE_STRING_FLAG (type)
- && TREE_CODE (type) == ARRAY_TYPE
+ if (TREE_CODE (type) == ARRAY_TYPE
+ && TYPE_STRING_FLAG (type)
&& is_fortran ()
&& TYPE_MODE (TREE_TYPE (type)) == TYPE_MODE (char_type_node))
{
+2019-06-24 Jan Hubicka <jh@suse.cz>
+
+ * 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.
+
2019-06-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/89782
start.expr = gfc_evaluate_now (start.expr, &se->pre);
/* Change the start of the string. */
- if (TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
+ if ((TREE_CODE (TREE_TYPE (se->expr)) == ARRAY_TYPE
+ || TREE_CODE (TREE_TYPE (se->expr)) == INTEGER_TYPE)
+ && TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
tmp = se->expr;
else
tmp = build_fold_indirect_ref_loc (input_location,
return;
}
- if (TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
+ if ((TREE_CODE (TREE_TYPE (se->expr)) == ARRAY_TYPE
+ || TREE_CODE (TREE_TYPE (se->expr)) == INTEGER_TYPE)
+ && TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
{
if (TREE_CODE (se->expr) != INDIRECT_REF)
{
|| GFC_CLASS_TYPE_P (type))
return false;
}
- if (TYPE_STRING_FLAG (type))
+ if ((TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == INTEGER_TYPE)
+ && TYPE_STRING_FLAG (type))
return false;
if (INTEGRAL_TYPE_P (type)
|| SCALAR_FLOAT_TYPE_P (type)
tmp = gfc_build_addr_expr (pvoid_type_node, base);
tmp = fold_build_pointer_plus_loc (input_location, tmp, offset);
tmp = fold_convert (build_pointer_type (type), tmp);
- if (!TYPE_STRING_FLAG (type))
+ if ((TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != ARRAY_TYPE)
+ || !TYPE_STRING_FLAG (type))
tmp = build_fold_indirect_ref_loc (input_location, tmp);
return tmp;
}
if (!TYPE_CONTEXT (t))
return false;
+ gcc_checking_assert (TREE_CODE (t) == ENUMERAL_TYPE || TYPE_CXX_ODR_P (t));
+
return true;
}
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
{
hstate.add_hwi (TYPE_MODE (t));
- hstate.add_flag (TYPE_STRING_FLAG (t));
/* TYPE_NO_FORCE_BLK is private to stor-layout and need
no streaming. */
hstate.add_flag (TYPE_PACKED (t));
{
hstate.add_flag (TYPE_TRANSPARENT_AGGR (t));
hstate.add_flag (TYPE_FINAL_P (t));
+ hstate.add_flag (TYPE_CXX_ODR_P (t));
}
else if (code == ARRAY_TYPE)
hstate.add_flag (TYPE_NONALIASED_COMPONENT (t));
+ if (code == ARRAY_TYPE || code == INTEGER_TYPE)
+ hstate.add_flag (TYPE_STRING_FLAG (t));
if (AGGREGATE_TYPE_P (t))
hstate.add_flag (TYPE_TYPELESS_STORAGE (t));
hstate.commit_flag ();
+2019-06-24 Jan Hubicka <jh@suse.cz>
+
+ * lto-common.c (compare_tree_sccs_1): Compare CXX_ODR_P;
+ compare STRING_FLAG only for arrays and integers.
+
2019-06-05 Martin Sebor <msebor@redhat.com>
* lto-common.c (lto_file_finalize): Adjust quoting and hyphenation.
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
{
compare_values (TYPE_MODE);
- compare_values (TYPE_STRING_FLAG);
compare_values (TYPE_NEEDS_CONSTRUCTING);
if (RECORD_OR_UNION_TYPE_P (t1))
{
compare_values (TYPE_TRANSPARENT_AGGR);
compare_values (TYPE_FINAL_P);
+ compare_values (TYPE_CXX_ODR_P);
}
else if (code == ARRAY_TYPE)
compare_values (TYPE_NONALIASED_COMPONENT);
+ if (code == ARRAY_TYPE || code == INTEGER_TYPE)
+ compare_values (TYPE_STRING_FLAG);
if (AGGREGATE_TYPE_P (t1))
compare_values (TYPE_TYPELESS_STORAGE);
compare_values (TYPE_EMPTY_P);
if (TYPE_NO_FORCE_BLK (node))
fputs (" no-force-blk", file);
- if (TYPE_STRING_FLAG (node))
+ if (code == ARRAY_TYPE && TYPE_STRING_FLAG (node))
fputs (" string-flag", file);
if (TYPE_NEEDS_CONSTRUCTING (node))
&& TYPE_REVERSE_STORAGE_ORDER (node))
fputs (" reverse-storage-order", file);
+ if ((code == RECORD_TYPE
+ || code == UNION_TYPE)
+ && TYPE_CXX_ODR_P (node))
+ fputs (" cxx-odr-p", file);
+
/* The transparent-union flag is used for different things in
different nodes. */
if ((code == UNION_TYPE || code == RECORD_TYPE)
ENUM_BITFIELD(machine_mode) mode : 8;
+ /* TYPE_STRING_FLAG for INTEGER_TYPE and ARRAY_TYPE.
+ TYPE_CXX_ODR_P for RECORD_TYPE and UNION_TYPE. */
unsigned string_flag : 1;
unsigned lang_flag_0 : 1;
unsigned lang_flag_1 : 1;
mode = bp_unpack_machine_mode (bp);
SET_TYPE_MODE (expr, mode);
- TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1);
/* TYPE_NO_FORCE_BLK is private to stor-layout and need
no streaming. */
TYPE_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1);
{
TYPE_TRANSPARENT_AGGR (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_FINAL_P (expr) = (unsigned) bp_unpack_value (bp, 1);
+ TYPE_CXX_ODR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
}
else if (TREE_CODE (expr) == ARRAY_TYPE)
TYPE_NONALIASED_COMPONENT (expr) = (unsigned) bp_unpack_value (bp, 1);
+ if (TREE_CODE (expr) == ARRAY_TYPE || TREE_CODE (expr) == INTEGER_TYPE)
+ TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1);
if (AGGREGATE_TYPE_P (expr))
TYPE_TYPELESS_STORAGE (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_EMPTY_P (expr) = (unsigned) bp_unpack_value (bp, 1);
not necessary valid in a global context.
Use the raw value previously set by layout_type. */
bp_pack_machine_mode (bp, TYPE_MODE_RAW (expr));
- bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1);
/* TYPE_NO_FORCE_BLK is private to stor-layout and need
no streaming. */
bp_pack_value (bp, TYPE_PACKED (expr), 1);
{
bp_pack_value (bp, TYPE_TRANSPARENT_AGGR (expr), 1);
bp_pack_value (bp, TYPE_FINAL_P (expr), 1);
+ bp_pack_value (bp, TYPE_CXX_ODR_P (expr), 1);
}
else if (TREE_CODE (expr) == ARRAY_TYPE)
bp_pack_value (bp, TYPE_NONALIASED_COMPONENT (expr), 1);
+ if (TREE_CODE (expr) == ARRAY_TYPE || TREE_CODE (expr) == INTEGER_TYPE)
+ bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1);
if (AGGREGATE_TYPE_P (expr))
bp_pack_value (bp, TYPE_TYPELESS_STORAGE (expr), 1);
bp_pack_value (bp, TYPE_EMPTY_P (expr), 1);
&& decl == TYPE_NAME (TREE_TYPE (decl))
&& TYPE_MAIN_VARIANT (TREE_TYPE (decl)) == TREE_TYPE (decl)
&& !TYPE_ARTIFICIAL (TREE_TYPE (decl))
+ && ((TREE_CODE (TREE_TYPE (decl)) != RECORD_TYPE
+ && TREE_CODE (TREE_TYPE (decl)) != UNION_TYPE)
+ || TYPE_CXX_ODR_P (TREE_TYPE (decl)))
&& (type_with_linkage_p (TREE_TYPE (decl))
|| TREE_CODE (TREE_TYPE (decl)) == INTEGER_TYPE)
&& !variably_modified_type_p (TREE_TYPE (decl), NULL_TREE))
Ada also builds variants of types with different TYPE_CONTEXT. */
if ((!in_lto_p || !TYPE_FILE_SCOPE_P (t)) && 0)
verify_variant_match (TYPE_CONTEXT);
- verify_variant_match (TYPE_STRING_FLAG);
+ if (TREE_CODE (t) == ARRAY_TYPE || TREE_CODE (t) == INTEGER_TYPE)
+ verify_variant_match (TYPE_STRING_FLAG);
+ if (TREE_CODE (t) == RECORD_TYPE || TREE_CODE (t) == UNION_TYPE)
+ verify_variant_match (TYPE_CXX_ODR_P);
if (TYPE_ALIAS_SET_KNOWN_P (t))
{
error ("type variant with %<TYPE_ALIAS_SET_KNOWN_P%>");
error ("%<TYPE_CACHED_VALUES_P%> is set while it should not be");
error_found = true;
}
- if (TYPE_STRING_FLAG (t)
- && TREE_CODE (t) != ARRAY_TYPE && TREE_CODE (t) != INTEGER_TYPE)
- {
- error ("%<TYPE_STRING_FLAG%> is set on wrong type code");
- error_found = true;
- }
/* ipa-devirt makes an assumption that TYPE_METHOD_BASETYPE is always
TYPE_MAIN_VARIANT and it would be odd to add methods only to variatns
TREE_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE)
#define NOT_RECORD_OR_UNION_CHECK(T) \
TREE_NOT_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE)
+#define ARRAY_OR_INTEGER_TYPE_CHECK(T) \
+ TREE_CHECK2 (T, ARRAY_TYPE, INTEGER_TYPE)
#define NUMERICAL_TYPE_CHECK(T) \
TREE_CHECK5 (T, INTEGER_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, REAL_TYPE, \
/* If set in an ARRAY_TYPE, indicates a string type (for languages
that distinguish string from array of char).
If set in a INTEGER_TYPE, indicates a character type. */
-#define TYPE_STRING_FLAG(NODE) (TYPE_CHECK (NODE)->type_common.string_flag)
+#define TYPE_STRING_FLAG(NODE) \
+ (ARRAY_OR_INTEGER_TYPE_CHECK (NODE)->type_common.string_flag)
+
+/* If set for RECORD_TYPE or UNION_TYPE it indicates that the type conforms
+ to the C++ one definition rule. This is used for LTO canonical type
+ computation. */
+#define TYPE_CXX_ODR_P(NODE) \
+ (RECORD_OR_UNION_CHECK (NODE)->type_common.string_flag)
/* Nonzero in a VECTOR_TYPE if the frontends should not emit warnings
about missing conversions to other vector types of the same size. */