diff mbox series

Fix PR tree-optimization/101626

Message ID 2151817.iZASKD2KPV@arcturus
State New
Headers show
Series Fix PR tree-optimization/101626 | expand

Commit Message

Eric Botcazou Aug. 5, 2021, 8:25 a.m. UTC
This is a regression present on the mainline, caused by an oversight of mine 
in an earlier fix for SRA, whereby I forgot to exclude cases for reverse SSO.

Tested on x86-64/Linux, applied on the mainline as obvious.


2021-08-05  Eric Botcazuo  <ebotcazou@adacore.com>

	PR tree-optimization/101626
	* tree-sra.c (propagate_subaccesses_from_rhs): Do not set the
	reverse scalar storage order on a pointer or vector component.


2021-08-05  Eric Botcazuo  <ebotcazou@adacore.com>

	* gcc.dg/sso-15.c: New test.
diff mbox series

Patch

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index c05d22f3e8f..3a9e14f50a0 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2790,7 +2790,10 @@  propagate_subaccesses_from_rhs (struct access *lacc, struct access *racc)
 	{
 	  /* We are about to change the access type from aggregate to scalar,
 	     so we need to put the reverse flag onto the access, if any.  */
-	  const bool reverse = TYPE_REVERSE_STORAGE_ORDER (lacc->type);
+	  const bool reverse
+	    = TYPE_REVERSE_STORAGE_ORDER (lacc->type)
+	      && !POINTER_TYPE_P (racc->type)
+	      && !VECTOR_TYPE_P (racc->type);
 	  tree t = lacc->base;
 
 	  lacc->type = racc->type;