summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/init.c1
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-21.C31
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bc9c49857f2..cca0229dc0a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/58325
+ * init.c (build_vec_delete): Call mark_rvalue_use on base.
+
2013-09-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/43452
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index df7dc7d3a48..8fabdcdb948 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -4128,6 +4128,7 @@ build_vec_delete (tree base, tree maxindex,
tree cookie_addr;
tree size_ptr_type = build_pointer_type (sizetype);
+ base = mark_rvalue_use (base);
if (TREE_SIDE_EFFECTS (base))
{
base_init = get_target_expr (base);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index befd28d2690..7da14443bb5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2013-09-09 Jakub Jelinek <jakub@redhat.com>
+ PR c++/58325
+ * g++.dg/warn/Wunused-var-21.C: New test.
+
PR tree-optimization/58364
* gcc.c-torture/execute/pr58364.c: New test.
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-21.C b/gcc/testsuite/g++.dg/warn/Wunused-var-21.C
new file mode 100644
index 00000000000..d279e598033
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-21.C
@@ -0,0 +1,31 @@
+// PR c++/58325
+// { dg-do compile }
+// { dg-options "-Wunused" }
+
+void
+f1 ()
+{
+ int *volatile a = new int[1];
+ delete[] a;
+}
+
+void
+f2 ()
+{
+ int *b = new int[1];
+ delete[] b;
+}
+
+void
+f3 ()
+{
+ int *volatile c = new int;
+ delete c;
+}
+
+void
+f4 ()
+{
+ int *d = new int;
+ delete d;
+}
OpenPOWER on IntegriCloud