re PR middle-end/12526 ([tree-ssa] internal compiler error: Segmentation fault)
authorJason Merrill <jason@gcc.gnu.org>
Fri, 14 Nov 2003 08:17:45 +0000 (03:17 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 14 Nov 2003 08:17:45 +0000 (03:17 -0500)
        PR middle-end/12526
        * tree.c (build): A CALL_EXPR has side-effects if its arguments do.
        * calls.c (call_expr_flags): New fn.
        * tree.h: Declare it.
        * tree-cfg.c (call_expr_flags): Move to calls.c.
        * tree-flow.h: Move prototype to tree.h.

From-SVN: r73588

gcc/testsuite/g++.dg/init/cleanup2.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/init/cleanup2.C b/gcc/testsuite/g++.dg/init/cleanup2.C
new file mode 100644 (file)
index 0000000..e62364b
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/12526
+
+// We decided that the call to strcmp has no side-effects because strcmp is
+// pure, even though the first argument has side-effects.  As a result, we
+// stripped the CLEANUP_POINT_EXPR.  Hilarity ensued.
+
+extern "C" int strcmp (const char *, const char *);
+
+struct A {
+  A(int);
+  const char *str();
+  ~A();
+};
+
+void printQueryI()
+{
+  if(!strcmp(A(1).str(), "foo"))
+    { }
+}