diff options
| author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-11 06:18:28 +0000 |
|---|---|---|
| committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-11 06:18:28 +0000 |
| commit | 16f4e759f176f2a62f1e1c10a641fd1e977938d1 (patch) | |
| tree | b44cdfcdef1b3171d3b746ae6f2c7d255425339c | |
| parent | c90e3f918b49b3836568a7c155f20ffee93174dd (diff) | |
| download | ppe42-gcc-16f4e759f176f2a62f1e1c10a641fd1e977938d1.tar.gz ppe42-gcc-16f4e759f176f2a62f1e1c10a641fd1e977938d1.zip | |
* cp/class.c (convert_to_base_statically): Fold produced tree; verify
that we are not processing template_decl.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123711 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/cp/class.c | 14 |
2 files changed, 15 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b9823dbdb2b..38ce783a47b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2007-04-11 Jan Hubicka <jh@suse.cz> + + * cp/class.c (convert_to_base_statically): Fold produced tree; verify + that we are not processing template_decl. + 2007-04-09 Mark Mitchell <mark@codesourcery.com> PR c++/31449 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index e01fbe13c1e..953cdffca7d 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -531,12 +531,18 @@ convert_to_base_statically (tree expr, tree base) tree pointer_type; pointer_type = build_pointer_type (expr_type); + + /* We use fold_build2 and fold_convert below to simplify the trees + provided to the optimizers. It is not safe to call these functions + when processing a template because they do not handle C++-specific + trees. */ + gcc_assert (!processing_template_decl); expr = build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1); if (!integer_zerop (BINFO_OFFSET (base))) - expr = build2 (PLUS_EXPR, pointer_type, expr, - build_nop (pointer_type, BINFO_OFFSET (base))); - expr = build_nop (build_pointer_type (BINFO_TYPE (base)), expr); - expr = build1 (INDIRECT_REF, BINFO_TYPE (base), expr); + expr = fold_build2 (PLUS_EXPR, pointer_type, expr, + fold_convert (pointer_type, BINFO_OFFSET (base))); + expr = fold_convert (build_pointer_type (BINFO_TYPE (base)), expr); + expr = build_fold_indirect_ref (expr); } return expr; |

