This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR63512


I forgot to mark stmts as modified.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-10-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/63512
	* tree-ssa-pre.c (create_expression_by_pieces): Mark stmts
	modified.

	* g++.dg/torture/pr63512.C: New testcase.
	
Index: gcc/tree-ssa-pre.c
===================================================================
--- gcc/tree-ssa-pre.c	(revision 216146)
+++ gcc/tree-ssa-pre.c	(working copy)
@@ -2897,6 +2897,7 @@ create_expression_by_pieces (basic_block
 	    }
 
 	  gimple_set_vuse (stmt, BB_LIVE_VOP_ON_EXIT (block));
+	  gimple_set_modified (stmt, true);
 	}
       gimple_seq_add_seq (stmts, forced_stmts);
     }
@@ -2904,6 +2905,7 @@ create_expression_by_pieces (basic_block
   name = make_temp_ssa_name (exprtype, NULL, "pretmp");
   newstmt = gimple_build_assign (name, folded);
   gimple_set_vuse (newstmt, BB_LIVE_VOP_ON_EXIT (block));
+  gimple_set_modified (newstmt, true);
   gimple_set_plf (newstmt, NECESSARY, false);
 
   gimple_seq_add_stmt (stmts, newstmt);
Index: gcc/testsuite/g++.dg/torture/pr63512.C
===================================================================
--- gcc/testsuite/g++.dg/torture/pr63512.C	(revision 0)
+++ gcc/testsuite/g++.dg/torture/pr63512.C	(working copy)
@@ -0,0 +1,46 @@
+// { dg-do compile }
+
+extern "C" {
+void __assert_fail ();
+unsigned long strlen (const char *);
+}
+class A
+{
+  int Data;
+  int Length;
+
+public:
+  A (const char *p1) : Data ()
+  {
+    p1 ? void() : __assert_fail ();
+    Length = strlen (p1);
+  }
+};
+enum TokenKind
+{
+  semi
+};
+class B
+{
+public:
+  void m_fn1 ();
+};
+class C
+{
+  void m_fn2 (TokenKind, int, A);
+  struct D
+  {
+    D (int);
+    B Range;
+  };
+  int *m_fn3 (const int &, int &, int **);
+};
+int a, b;
+int *
+C::m_fn3 (const int &, int &, int **)
+{
+  D c (0);
+  if (a)
+    c.Range.m_fn1 ();
+  m_fn2 (semi, 0, b ? "" : a ? "alias declaration" : "using declaration");
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]