https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113207
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
#0 0x0000000001d381f4 in copy_node (node=<pointer_type 0x7ffff6fbe5e8>)
at /space/rguenther/src/gcc/gcc/tree.cc:1361
#1 0x0000000001d4a2e5 in build_distinct_type_copy (
type=<pointer_type 0x7ffff6fbe5e8>)
at /space/rguenther/src/gcc/gcc/tree.cc:5765
#2 0x0000000001d4a45e in build_variant_type_copy (
type=<pointer_type 0x7ffff6fbe5e8>)
at /space/rguenther/src/gcc/gcc/tree.cc:5799
#3 0x0000000003423b7a in (anonymous namespace)::fld_type_variant (
first=<pointer_type 0x7ffff6fbe5e8>,
t=<pointer_type 0x7ffff6fbe888 cl_object>, fld=0x7fffffffda90,
inner_type=<tree 0x0>)
at /space/rguenther/src/gcc/gcc/ipa-free-lang-data.cc:154
#4 0x0000000003424656 in (anonymous namespace)::fld_incomplete_type_of (
t=<pointer_type 0x7ffff6fbe888 cl_object>, fld=0x7fffffffda90)
at /space/rguenther/src/gcc/gcc/ipa-free-lang-data.cc:261
#5 0x0000000003424e38 in (anonymous namespace)::fld_simplified_type (
t=<pointer_type 0x7ffff6fbe888 cl_object>, fld=0x7fffffffda90)
at /space/rguenther/src/gcc/gcc/ipa-free-lang-data.cc:344
#6 0x00000000034253d2 in (anonymous namespace)::free_lang_data_in_type (
type=<function_type 0x7ffff6fbe930>, fld=0x7fffffffda90)
at /space/rguenther/src/gcc/gcc/ipa-free-lang-data.cc:431
builts the two distinct pointers. It goes all good up to the
fld_type_variant call where we fail to match up with
fld_simplified_type_name but then we build another variant through
the regular build_qualified_type in
437 for (tree p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p))
438 {
439 TREE_VALUE (p) = fld_simplified_type (TREE_VALUE (p), fld);
440 tree arg_type = TREE_VALUE (p);
441
442 if (TYPE_READONLY (arg_type) || TYPE_VOLATILE (arg_type))
443 {
444 int quals = TYPE_QUALS (arg_type)
445 & ~TYPE_QUAL_CONST
(gdb)
446 & ~TYPE_QUAL_VOLATILE;
447 TREE_VALUE (p) = build_qualified_type (arg_type, quals);
which we are able to pick up earlier before reaching the originally
built simplified type.
diff --git a/gcc/ipa-free-lang-data.cc b/gcc/ipa-free-lang-data.cc
index cb26e262f45..be96d2928d7 100644
--- a/gcc/ipa-free-lang-data.cc
+++ b/gcc/ipa-free-lang-data.cc
@@ -150,7 +150,12 @@ fld_type_variant (tree first, tree t, class
free_lang_data_d *fld,
return t;
for (tree v = first; v; v = TYPE_NEXT_VARIANT (v))
if (fld_type_variant_equal_p (t, v, inner_type))
- return v;
+ {
+ if (flag_checking)
+ for (tree v2 = TYPE_NEXT_VARIANT (v); v2; v2 = TYPE_NEXT_VARIANT
(v2))
+ gcc_assert (!fld_type_variant_equal_p (t, v2, inner_type));
+ return v;
+ }
tree v = build_variant_type_copy (first);
TYPE_READONLY (v) = TYPE_READONLY (t);
TYPE_VOLATILE (v) = TYPE_VOLATILE (t);
shows this by ICEing there, finding two possible candidates. I guess
we should never call build_qualified_type on a fld_simplified_type
type, or, we need to make sure fld_type_variant_equal_p also finds
regular qualified types. The inconsistent differentiator here
seems to be fld_simplified_type_name.
I suspect the above checking would trip far more often than the old
failure mode.