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 PR c++/17368, asm expressions have cleanup


Looks like someone forgot that asm expressions can have cleanup as
you have sub expressions which needs cleanup.  This patch fixes the
PR and fixes the problem.

OK? Bootstrapped and tested on powerpc-darwin with no regressions.

Thanks,
Andrew Pinski

Testcase:
struct A
{
    ~A();
};
int foo(A);
void bar()
{
    A a;
    asm("" : : "r"(foo(a)) );//<-- cleanup needed here.
};

ChangeLog:
	* semantics.c (finish_asm_stmt): Asm expressions need cleanup
	also.

Index: semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.441
diff -u -p -r1.441 semantics.c
--- semantics.c	1 Oct 2004 15:11:21 -0000	1.441
+++ semantics.c	5 Oct 2004 14:06:57 -0000
@@ -1178,6 +1178,7 @@ finish_asm_stmt (int volatile_p, tree st
 		  output_operands, input_operands,
 		  clobbers);
   ASM_VOLATILE_P (r) = volatile_p;
+  r = maybe_cleanup_point_expr (r);
   return add_stmt (r);
 }


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