public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR 91605
@ 2019-09-01 10:36 Bernd Edlinger
  2019-09-02  7:50 ` Richard Biener
  2019-09-03 18:40 ` Jeff Law
  0 siblings, 2 replies; 7+ messages in thread
From: Bernd Edlinger @ 2019-09-01 10:36 UTC (permalink / raw)
  To: gcc-patches, Richard Biener, Jeff Law

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

Hi,

this fixes an oversight in r274986.
We need to avoid using movmisalign on DECL_P which are not in memory,
similar to the !mem_ref_refers_to_non_mem_p which unfortunately can't
handle DECL_P.


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-pr91605.diff --]
[-- Type: text/x-patch; name="patch-pr91605.diff", Size: 1373 bytes --]

2019-09-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR middle-end/91605
	* expr.c (expand_assignment): Avoid DECL_P with DECL_RTL
	not being MEM_P.

testsuite:
2019-09-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR middle-end/91605
	* g++.target/i386/pr91605.C: New test.

Index: gcc/expr.c
===================================================================
--- gcc/expr.c	(revision 275063)
+++ gcc/expr.c	(working copy)
@@ -5004,7 +5004,8 @@ expand_assignment (tree to, tree from, bool nontem
        || TREE_CODE (to) == TARGET_MEM_REF
        || DECL_P (to))
       && mode != BLKmode
-      && (DECL_P (to) || !mem_ref_refers_to_non_mem_p (to))
+      && (DECL_P (to) ? MEM_P (DECL_RTL (to))
+		      : !mem_ref_refers_to_non_mem_p (to))
       && ((align = get_object_alignment (to))
 	  < GET_MODE_ALIGNMENT (mode))
       && (((icode = optab_handler (movmisalign_optab, mode))
Index: gcc/testsuite/g++.target/i386/pr91605.C
===================================================================
--- gcc/testsuite/g++.target/i386/pr91605.C	(revision 0)
+++ gcc/testsuite/g++.target/i386/pr91605.C	(working copy)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fpack-struct -mavx" } */
+
+struct A {
+  __attribute__((__vector_size__(4 * sizeof(double)))) double data;
+};
+struct B {
+  A operator*(B);
+};
+void fn1() {
+  B x, y;
+  x *y;
+}

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-09-03 18:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-01 10:36 [PATCH] Fix PR 91605 Bernd Edlinger
2019-09-02  7:50 ` Richard Biener
2019-09-02 14:02   ` Bernd Edlinger
2019-09-02 14:04     ` Richard Biener
2019-09-03 18:40 ` Jeff Law
2019-09-03 18:46   ` Bernd Edlinger
2019-09-03 18:47     ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).