This is the mail archive of the 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++/17907, missing CLEANUP_POINT_EXPR

We are missing a CLEANUP_POINT_EXPR for DECL_EXPR with size which needs
cleanup.  This patch fixes the problem.

OK? Bootstrapped and tested on powerpc-darwin.

Andrew Pinski

struct String {
  int size() const;
struct CodingSystem {
  String convertOut() const;
void inputOpened(CodingSystem *outputCodingSystem)
   char filePath[outputCodingSystem->convertOut().size()];

	* semantics.c (add_decl_expr): If the decl has a size which
	has side effects then the decl expression needs a cleanup point.

Index: semantics.c
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.442
diff -u -p -r1.442 semantics.c
--- semantics.c	6 Oct 2004 22:09:22 -0000	1.442
+++ semantics.c	9 Oct 2004 16:07:28 -0000
@@ -368,7 +368,8 @@ void
 add_decl_expr (tree decl)
   tree r = build_stmt (DECL_EXPR, decl);
-  if (DECL_INITIAL (decl))
+  if (DECL_INITIAL (decl)
+      || (DECL_SIZE (decl) && TREE_SIDE_EFFECTS (DECL_SIZE (decl))))
     r = maybe_cleanup_point_expr (r);
   add_stmt (r);

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