------- Comment #8 from abel at gcc dot gnu dot org  2010-02-16 07:51 -------
I needed explicit --enable-tls to reproduce this.  The problem seems to be in
dump_minipool.  We are gathering values to fix in the Mnode structures and then
we are issuing insns with those values.  However, when a value is a constant,
we get two insns with the same CONST: parts of the pattern, which is not
permitted and is caught by the verifier.  

To fix this, it is enough to unshare the values before emitting.  The below
patch does this only for CONSTANT_P rtxes and fixes the bug.  Is it fine or do
we want to unconditionally unshare the rtx to be absolutely sure this will not
happen again?  I do not know ARM backend good enough to judge.

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 466981a..2edae15 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -10917,6 +10917,8 @@ dump_minipool (rtx scan)
     {
       if (mp->refcount > 0)
        {
+         rtx value;
+
          if (dump_file)
            {
              fprintf (dump_file,
@@ -10927,35 +10929,36 @@ dump_minipool (rtx scan)
              fputc ('\n', dump_file);
            }

+         value = CONSTANT_P (mp->value) ? copy_rtx (mp->value) : mp->value;
          switch (mp->fix_size)
            {
 #ifdef HAVE_consttable_1
            case 1:
-             scan = emit_insn_after (gen_consttable_1 (mp->value), scan);
+             scan = emit_insn_after (gen_consttable_1 (value), scan);
              break;

 #endif
 #ifdef HAVE_consttable_2
            case 2:
-             scan = emit_insn_after (gen_consttable_2 (mp->value), scan);
+             scan = emit_insn_after (gen_consttable_2 (value), scan);
              break;

 #endif
 #ifdef HAVE_consttable_4
            case 4:
-             scan = emit_insn_after (gen_consttable_4 (mp->value), scan);
+             scan = emit_insn_after (gen_consttable_4 (value), scan);
              break;

 #endif
 #ifdef HAVE_consttable_8
            case 8:
-             scan = emit_insn_after (gen_consttable_8 (mp->value), scan);
+             scan = emit_insn_after (gen_consttable_8 (value), scan);
              break;

 #endif
 #ifdef HAVE_consttable_16
            case 16:
-              scan = emit_insn_after (gen_consttable_16 (mp->value), scan);
+              scan = emit_insn_after (gen_consttable_16 (value), scan);
               break;

 #endif


-- 


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

Reply via email to