This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[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
- From: "jamborm at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 04 May 2017 12:56:43 +0000
- Subject: [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
- Auto-submitted: auto-generated
- References: <bug-80622-4@http.gcc.gnu.org/bugzilla/>
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;