Commit 3c784bca by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/58325 (Spurious unused-but-set-variable warning on delete[] of volatile pointer)

	PR c++/58325
	* init.c (build_vec_delete): Call mark_rvalue_use on base.

	* g++.dg/warn/Wunused-var-21.C: New test.

From-SVN: r202411
parent 28fd0ba2
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
......
......@@ -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);
......
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.
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment