This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/80622] [8 Regression] wrong code at -O1 and above in both 32-bit and 64-bit modes on x86_64-linux-gnu


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

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The simplest fix is the following, but I'll move the whole test a bit
earlier in a patch to the mailing list:

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 1606573aead..79ca1666c15 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2581,8 +2581,10 @@ propagate_subaccesses_across_link (struct access *lacc,
struct access *racc)

   /* IF the LHS is still not marked as being written to, we only need to do so
      if the RHS at this level actually was.  */
-  if (!lacc->grp_write &&
-      (racc->grp_write || TREE_CODE (racc->base) == PARM_DECL))
+  if (!lacc->grp_write
+      && (racc->grp_write
+         || TREE_CODE (racc->base) == PARM_DECL
+         || constant_decl_p (racc->base)))
     {
       lacc->grp_write = true;
       ret = true;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]