public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR77826
@ 2016-10-04 10:34 Richard Biener
  2016-10-05 11:38 ` Richard Biener
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Biener @ 2016-10-04 10:34 UTC (permalink / raw)
  To: gcc-patches


The following will fix PR77826, the issue that in match.pd matching
up two things uses operand_equal_p which is too lax about the type
of the toplevel entity (at least for integer constants).

Bootstrap / regtest pending on x86_64-unknown-linux-gnu.

Richard.

2016-10-04  Richard Biener  <rguenther@suse.de>

	PR middle-end/77826
	* genmatch.c (dt_operand::gen_match_op): Amend operand_equal_p
	with types_match to handle type mismatched constants properly.

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

Index: gcc/genmatch.c
===================================================================
--- gcc/genmatch.c	(revision 240739)
+++ gcc/genmatch.c	(working copy)
@@ -2593,8 +2601,10 @@ dt_operand::gen_match_op (FILE *f, int i
 {
   char match_opname[20];
   match_dop->get_name (match_opname);
-  fprintf_indent (f, indent, "if (%s == %s || operand_equal_p (%s, %s, 0))\n",
-		  opname, match_opname, opname, match_opname);
+  fprintf_indent (f, indent, "if (%s == %s || (operand_equal_p (%s, %s, 0) "
+		  "&& types_match (%s, %s)))\n",
+		  opname, match_opname, opname, match_opname,
+		  opname, match_opname);
   fprintf_indent (f, indent + 2, "{\n");
   return 1;
 }
Index: gcc/testsuite/gcc.dg/torture/pr77826.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr77826.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr77826.c	(working copy)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+void
+fi(unsigned long int *v0, unsigned int ow, int q2)
+{
+  if (ow + q2 != 0)
+    if (q2 == 1)
+      {
+	*v0 |= q2;
+	q2 ^= *v0;
+      }
+}

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

end of thread, other threads:[~2016-10-17  7:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-04 10:34 [PATCH] Fix PR77826 Richard Biener
2016-10-05 11:38 ` Richard Biener
2016-10-06 18:44   ` Marc Glisse
2016-10-07  7:36     ` Richard Biener
2016-10-10  8:47       ` Marc Glisse
2016-10-11  9:09         ` Richard Biener
2016-10-11 20:35           ` Marc Glisse
2016-10-12 11:34             ` Richard Biener
2016-10-12 12:49               ` Marc Glisse
2016-10-12 13:25                 ` Richard Biener
2016-10-13  8:29                   ` Richard Biener
2016-10-15 21:50                     ` Marc Glisse
2016-10-17  7:59                       ` Richard Biener

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).