[Bug target/91102] [9/10 Regression] aarch64 ICE on Linux kernel with -Os starting with r270266

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jul 7 09:13:00 GMT 2019


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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #2)
> 91102.c: In function 'foo':
> 91102.c:7:1: warning: control reaches end of non-void function
> [-Wreturn-type]
>     7 | }
>       | ^
> 
> so ice-on-invalid-code?

Well, invalid at runtime, so valid if not called.

> Although, hrm, inserting "return 3;" there still ICEs.

The testcase has been creduced and hand cleaned up, forgot about the return
value.
Let's talk about

int
foo (long d, long l)
{
  register long e asm ("x1") = d;
  register long f asm("x2") = l;
  asm ("" : : "r" (e), "r" (f));
  return 3;
}

struct T { int i; int j; };
union S { long h; struct T t; };

void
bar (union S b)
{
  while (1)
    {
      union S c = b;
      c.t.j++;
      b.h = foo (b.h, c.h);
    }
}

then.  The change is done in decrease_live_ranges_number:
2128                            if (sregno < FIRST_PSEUDO_REGISTER
2129                                && reg_mentioned_p (dest, PATTERN (q)))
2130                              failed = 1;
2131                            
2132                            /* Attempt to replace all uses.  */
2133                            else if (!validate_replace_rtx (src, dest, q))
2134                              failed = 1;

So, shouldn't we have some code for dregno < FIRST_PSEUDO_REGISTER that checks
for cases like this (dunno what exactly, just insns where already at least one
of the operands from extract_operands is a hard register, or more specifically
don't propagate into an operand that has number in a constraint and
corresponding argument is already (a different) hard register, something else?


More information about the Gcc-bugs mailing list