DECL_NONLOCAL_FRAME is only valid on VAR_DECL.

I'm checking whether this fixes D bootstrap (it obviously should) and
will then push.

Richard.

        PR tree-optimization/99959
        * tree-sra.cc (create_access_replacement): Guard DECL_NONLOCAL_FRAME
        access.
---
 gcc/tree-sra.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc
index 7f6d560e429..f4b672300aa 100644
--- a/gcc/tree-sra.cc
+++ b/gcc/tree-sra.cc
@@ -2589,7 +2589,7 @@ create_access_replacement (struct access *access, tree 
reg_type = NULL_TREE)
 
   if (DECL_NAME (access->base)
       && ((!DECL_IGNORED_P (access->base) && !DECL_ARTIFICIAL (access->base))
-         || DECL_NONLOCAL_FRAME (access->base)))
+         || (VAR_P (access->base) && DECL_NONLOCAL_FRAME (access->base))))
     {
       char *pretty_name = make_fancy_name (access->expr);
       tree debug_expr = unshare_expr_without_location (access->expr), d;
-- 
2.51.0

Reply via email to