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



--- Comment #6 from Steven Bosscher <steven at gcc dot gnu.org> 2013-01-16 
20:59:17 UTC ---

I had expected the following patch to fix the issue:



        * lra-assigns.c (assign_by_spills): Throw away the pattern of asms

        that have operands with impossible constraints.

        * lra-constraints.c (process_alt_operands): Verify that a class

        selected from constraints on asms is valid for the operand mode.



Index: lra-assigns.c

===================================================================

--- lra-assigns.c       (revision 195104)

+++ lra-assigns.c       (working copy)

@@ -1240,6 +1240,9 @@ assign_by_spills (void)

                  asm_p = true;

                  error_for_asm (insn,

                                 "%<asm%> operand has impossible constraints");

+                 /* Avoid further trouble with this insn.  */

+                 PATTERN (insn) = gen_rtx_USE (VOIDmode, const0_rtx);

+                 lra_set_insn_deleted (insn);

                }

            }

          lra_assert (asm_p);

Index: lra-constraints.c

===================================================================

--- lra-constraints.c   (revision 195104)

+++ lra-constraints.c   (working copy)

@@ -1809,6 +1809,20 @@ process_alt_operands (int only_alternati

            }

          while ((p += len), c);



+         /* For asms, verify that the class for this alternative is possible

+            for the mode that is specified.  */

+         if (INSN_CODE (curr_insn) < 0)

+           {

+             int i;

+             gcc_assert (n_alternatives == 1);

+             for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)

+               if (HARD_REGNO_MODE_OK (i, mode)

+                   && in_hard_reg_set_p (reg_class_contents[this_alternative],

mode, i))

+                 break;

+             if (i == FIRST_PSEUDO_REGISTER)

+               return false;

+           }

+

          /* Record which operands fit this alternative.  */

          if (win)

            {









But this results in a different error message than before:

$ ./cc1 -quiet -O2 t.c

t.c: In function 'foo':

t.c:5:3: error: inconsistent operand constraints in an 'asm'

   __asm ("" : "=x" (x)); /* { dg-error "impossible register constraint" } */

   ^



Personally I don't care one way or the other: impossible or inconsistent,

bottom line it's a bad constraint. What do others think about this?

Reply via email to