diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 793e4afffcb..11acab7008e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2020-02-14 Jakub Jelinek + + PR libstdc++/92906 + * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE, + CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE. + (fallback_dfloat32_type, fallback_dfloat64_type, + fallback_dfloat128_type): Define. + * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like + dfloat*_type_node. + * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp + is disabled for compatibility. + 2020-02-13 Jason Merrill PR c++/93713 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 53de2b0afe7..c1aafa1de3a 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -206,6 +206,10 @@ enum cp_tree_index CPTI_SOURCE_LOCATION_IMPL, + CPTI_FALLBACK_DFLOAT32_TYPE, + CPTI_FALLBACK_DFLOAT64_TYPE, + CPTI_FALLBACK_DFLOAT128_TYPE, + CPTI_MAX }; @@ -366,6 +370,12 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; #define access_default_node null_node +/* Variant of dfloat{32,64,128}_type_node only used for fundamental + rtti purposes if DFP is disabled. */ +#define fallback_dfloat32_type cp_global_trees[CPTI_FALLBACK_DFLOAT32_TYPE] +#define fallback_dfloat64_type cp_global_trees[CPTI_FALLBACK_DFLOAT64_TYPE] +#define fallback_dfloat128_type cp_global_trees[CPTI_FALLBACK_DFLOAT128_TYPE] + #include "name-lookup.h" diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 23baa382ed9..a0e888fde62 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2569,11 +2569,11 @@ write_builtin_type (tree type) write_char ('d'); else if (type == long_double_type_node) write_char ('e'); - else if (type == dfloat32_type_node) + else if (type == dfloat32_type_node || type == fallback_dfloat32_type) write_string ("Df"); - else if (type == dfloat64_type_node) + else if (type == dfloat64_type_node || type == fallback_dfloat64_type) write_string ("Dd"); - else if (type == dfloat128_type_node) + else if (type == dfloat128_type_node || type == fallback_dfloat128_type) write_string ("De"); else gcc_unreachable (); diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 36c1b4ed7bc..f20941c413b 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1588,6 +1588,20 @@ emit_support_tinfos (void) } for (tree t = registered_builtin_types; t; t = TREE_CHAIN (t)) emit_support_tinfo_1 (TREE_VALUE (t)); + /* For compatibility, emit DFP typeinfos even when DFP isn't enabled, + because we've emitted that in the past. */ + if (!targetm.decimal_float_supported_p ()) + { + gcc_assert (dfloat32_type_node == NULL_TREE + && dfloat64_type_node == NULL_TREE + && dfloat128_type_node == NULL_TREE); + fallback_dfloat32_type = make_node (REAL_TYPE); + fallback_dfloat64_type = make_node (REAL_TYPE); + fallback_dfloat128_type = make_node (REAL_TYPE); + emit_support_tinfo_1 (fallback_dfloat32_type); + emit_support_tinfo_1 (fallback_dfloat64_type); + emit_support_tinfo_1 (fallback_dfloat128_type); + } input_location = saved_loc; }