[Bug lto/42020] field not merged causes cc1 to be miscompiled

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Nov 18 10:56:00 GMT 2009



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-11-18 10:55 -------
Hm, the assert doesn't trigger if I add a tem != field check.  In fact I do not
understand the assert you added at all ;)  We do find the correct field, if
that ends up still being the wrong one then DECL_CONTEXT is already wrong
which means we end up not unifying types as we should.

In fact for the testcase both FIELD_DECLs of the two COMPONENT_REFs for
new_bb->succs and bb->succs are the same.

So - did you just not properly reduce the testcase?  The assert to be put
in I suggested would have been

Index: gcc/lto-streamer-in.c
===================================================================
--- gcc/lto-streamer-in.c       (revision 154283)
+++ gcc/lto-streamer-in.c       (working copy)
@@ -1091,8 +1091,8 @@ input_gimple_stmt (struct lto_input_bloc
                  /* In case of type mismatches across units we can fail
                     to unify some types and thus not find a proper
                     field-decl here.  Just do nothing in this case.  */
-                 if (tem != NULL_TREE)
-                   TREE_OPERAND (op, 1) = tem;
+                 gcc_assert (tem != NULL_TREE);
+                 TREE_OPERAND (op, 1) = tem;
                }

              op = TREE_OPERAND (op, 0);

which I probably should re-add under ENABLE_CHECKING at least (I think it
failed somewhere in SPEC though).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42020



More information about the Gcc-bugs mailing list