https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97162
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we're getting a CONST_DECL into compare_base_decls which doesn't have RTL
but DECL_REGISTER requires DECL_WITH_RTL. One fix would be
diff --git a/gcc/alias.c b/gcc/alias.c
index 1cb702be2ce..3f01c7072d2 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2142,7 +2142,9 @@ compare_base_decls (tree base1, tree base2)
/* If we have two register decls with register specification we
cannot decide unless their assembler names are the same. */
- if (DECL_REGISTER (base1)
+ if (HAS_RTL_P (base1)
+ && HAS_RTL_P (base2)
+ && DECL_REGISTER (base1)
&& DECL_REGISTER (base2)
&& HAS_DECL_ASSEMBLER_NAME_P (base1)
&& HAS_DECL_ASSEMBLER_NAME_P (base2)
but I wonder if we instead want
VAR_P (base1) && DECL_HARD_REGISTER (base1)
? So I'm testing the following which also fixes the testcase
diff --git a/gcc/alias.c b/gcc/alias.c
index 1cb702be2ce..f6d7a1791c4 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2142,10 +2142,10 @@ compare_base_decls (tree base1, tree base2)
/* If we have two register decls with register specification we
cannot decide unless their assembler names are the same. */
- if (DECL_REGISTER (base1)
- && DECL_REGISTER (base2)
- && HAS_DECL_ASSEMBLER_NAME_P (base1)
- && HAS_DECL_ASSEMBLER_NAME_P (base2)
+ if (VAR_P (base1)
+ && VAR_P (base2)
+ && DECL_HARD_REGISTER (base1)
+ && DECL_HARD_REGISTER (base2)
&& DECL_ASSEMBLER_NAME_SET_P (base1)
&& DECL_ASSEMBLER_NAME_SET_P (base2))
{