public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix PR82102
Date: Tue, 05 Sep 2017 08:13:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.20.1709051012540.14191@zhemvz.fhfr.qr> (raw)


The following fixes PR82102, GIMPLE_NOPs don't have a lhs so we
have to care for that case.

Tested on x86_64-unknown-linux-gnu, applied as obvious.

Richard.

2017-09-05  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82102
	* tree-ssa-pre.c (fini_eliminate): Check if lhs is NULL.

	* gcc.dg/torture/pr82102.c: New testcase.

Index: gcc/tree-ssa-pre.c
===================================================================
--- gcc/tree-ssa-pre.c	(revision 251689)
+++ gcc/tree-ssa-pre.c	(working copy)
@@ -4860,6 +4860,7 @@ fini_eliminate (void)
 	lhs = gimple_get_lhs (stmt);
 
       if (inserted_exprs
+	  && lhs
 	  && TREE_CODE (lhs) == SSA_NAME
 	  && bitmap_bit_p (inserted_exprs, SSA_NAME_VERSION (lhs)))
 	continue;
Index: gcc/testsuite/gcc.dg/torture/pr82102.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr82102.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/torture/pr82102.c	(working copy)
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+void *a, *b;
+struct pt3_i2cbuf {
+    int num_cmds;
+} c;
+void *memcpy(void *, void *, __SIZE_TYPE__);
+void put_stop();
+void translate(struct pt3_i2cbuf *p1, int p2)
+{
+  p1->num_cmds = 0;
+  if (p2)
+    put_stop();
+}
+void pt3_i2c_master_xfer(int p1)
+{
+  translate(&c, p1);
+  memcpy(a, b, c.num_cmds);
+  for (; p1;)
+    ;
+}

                 reply	other threads:[~2017-09-05  8:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.20.1709051012540.14191@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).