aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-03-27 19:16:36 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-03-27 19:16:36 +0000
commitcd4e8331bda6da5351e414c967dcb59c1c107b92 (patch)
treecd6f6b7ee260d38dfdad006c1ae405e4579dbfc7 /gcc
parentc9d892a83fc5ef512d01237b12c8b6c7dc3acdae (diff)
downloadgcc-cd4e8331bda6da5351e414c967dcb59c1c107b92.zip
gcc-cd4e8331bda6da5351e414c967dcb59c1c107b92.tar.gz
gcc-cd4e8331bda6da5351e414c967dcb59c1c107b92.tar.bz2
re PR c++/4884 (g++ 3.0.2 problem with -fvolatile)
* g++.dg/init/new2.C: New test. PR c++/4884 * call.c (build_op_delete_call): Allow for the fact the placement may be a COMPOUND_EXPR. From-SVN: r51466
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c19
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/init/new2.C18
4 files changed, 41 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a9b75a9..7bd5c22 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/4884
+ * call.c (build_op_delete_call): Allow for the fact the placement
+ may be a COMPOUND_EXPR.
+
2002-03-27 Neil Booth <neil@daikokuya.demon.co.uk>
* cp-lang.c (LANG_HOOKS_EXPAND_EXPR): Redefine.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 9d26861..8804a61 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3611,15 +3611,22 @@ build_op_delete_call (code, addr, size, flags, placement)
if (placement)
{
- /* placement is a CALL_EXPR around an ADDR_EXPR around a function. */
-
+ tree alloc_fn;
+ tree call_expr;
+
+ /* Find the allocation function that is being called. */
+ call_expr = placement;
+ /* Sometimes we have a COMPOUND_EXPR, rather than a simple
+ CALL_EXPR. */
+ while (TREE_CODE (call_expr) == COMPOUND_EXPR)
+ call_expr = TREE_OPERAND (call_expr, 1);
/* Extract the function. */
- argtypes = TREE_OPERAND (TREE_OPERAND (placement, 0), 0);
+ alloc_fn = get_callee_fndecl (call_expr);
+ my_friendly_assert (alloc_fn != NULL_TREE, 20020327);
/* Then the second parm type. */
- argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (argtypes)));
-
+ argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn)));
/* Also the second argument. */
- args = TREE_CHAIN (TREE_OPERAND (placement, 1));
+ args = TREE_CHAIN (TREE_OPERAND (call_expr, 1));
}
else
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7be0736..f660231 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-03-27 Mark Mitchell <mark@codesourcery.com>
+
+ * g++.dg/init/new2.C: New test.
+
2002-03-26 Richard Henderson <rth@redhat.com>
* gcc.dg/pragma-re-2.c: Avoid empty source file warning.
diff --git a/gcc/testsuite/g++.dg/init/new2.C b/gcc/testsuite/g++.dg/init/new2.C
new file mode 100644
index 0000000..572cb28
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/new2.C
@@ -0,0 +1,18 @@
+// Origin: asharji@uwaterloo.ca
+
+// { dg-do compile }
+// { dg-options "-fvolatile" }
+
+class bar {
+ public :
+ bar() { }
+ void * operator new ( __SIZE_TYPE__ , void * storage )
+ { return (void *)1;}
+};
+
+class foo {
+ public:
+ void mem ( ) {
+ new ( 0 ) bar;
+ }
+};