https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59155

--- Comment #6 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Marc Glisse from comment #1)
> By the way, the following:
> 
> double f(double x){
>   asm volatile("":"+X"(x));
>   return x;
> }
> double g(){
>   return f(1.);
> }
> 
> is rejected with:
> 
> c.c: In function 'g':
> c.c:2:3: error: inconsistent operand constraints in an 'asm'
>    asm volatile("":"+X"(x));
>    ^

and this test case would be fixed by this:

Index: lra-constraints.c
===================================================================
--- lra-constraints.c   (revision 232034)
+++ lra-constraints.c   (working copy)
@@ -1789,7 +1789,7 @@
          if (curr_static_id->operand_alternative[opalt_num].anything_ok)
            {
              /* Fast track for no constraints at all.  */
-             curr_alt[nop] = NO_REGS;
+             curr_alt[nop] = ALL_REGS;
              CLEAR_HARD_REG_SET (curr_alt_set[nop]);
              curr_alt_win[nop] = true;
              curr_alt_match_win[nop] = false;


Hence anything_ok includes ALL_REGS, not NO_REGS at all.
The matching fails because %0 is a REG and %1 is a CONST
so they do not match at first, but a reload of CONST to a REG
is of course possible.

Reply via email to