re PR c++/17907 (ice in optimize_inline_calls, at tree-inline.c)

2004-10-10  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c++/17907
        * semantics.c (add_decl_expr): If the decl has a size which
        has side effects then the decl expression needs a cleanup point.
2004-10-10  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c++/17907
        * g++.dg/eh/cleanup5.C: New test.

From-SVN: r88867
This commit is contained in:
Andrew Pinski 2004-10-11 03:16:47 +00:00 committed by Andrew Pinski
parent 90d82a979d
commit b187901efa
4 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2004-10-10 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/17907
* semantics.c (add_decl_expr): If the decl has a size which
has side effects then the decl expression needs a cleanup point.
2004-10-10 Mark Mitchell <mark@codesourcery.com>
PR c++/17393

View File

@ -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);
}

View File

@ -1,3 +1,8 @@
2004-10-10 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/17907
* g++.dg/eh/cleanup5.C: New test.
2004-10-10 Mark Mitchell <mark@codesourcery.com>
PR c++/17393

View File

@ -0,0 +1,16 @@
// PR 17907
// { dg-do compile }
// We lost a CLEANUP_POINT_EXPR, leading to a crash destroying temp of A.
struct String {
~String();
int size() const;
};
struct CodingSystem {
String convertOut() const;
};
void inputOpened(CodingSystem *outputCodingSystem)
{
char filePath[outputCodingSystem->convertOut().size()];
}