From bd7e4636d946650249b6c430d33e6ccb70eb302a Mon Sep 17 00:00:00 2001 From: Roger Sayle <roger@eyesopen.com> Date: Thu, 4 Jan 2007 23:00:00 +0000 Subject: [PATCH] fold-const.c (fold_convert): When casting an expression to void... * fold-const.c (fold_convert): When casting an expression to void, fold_ignored_result may discover a GIMPLE_MODIFY_STMT which doesn't have a type. Instead of attempting to build a NOP_EXPR, return these "special" trees directly. From-SVN: r120451 --- gcc/ChangeLog | 7 +++++++ gcc/fold-const.c | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6b21eb1b69f..3f81da506274 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-01-04 Roger Sayle <roger@eyesopen.com> + + * fold-const.c (fold_convert): When casting an expression to void, + fold_ignored_result may discover a GIMPLE_MODIFY_STMT which doesn't + have a type. Instead of attempting to build a NOP_EXPR, return + these "special" trees directly. + 2007-01-04 Joseph Myers <joseph@codesourcery.com> * config/rs6000/rs6000.c (rs6000_rtx_costs): Make adjustment for diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 8826908054d4..559acf018adf 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2144,7 +2144,10 @@ fold_convert (tree type, tree arg) return fold_build1 (VIEW_CONVERT_EXPR, type, arg); case VOID_TYPE: - return fold_build1 (NOP_EXPR, type, fold_ignored_result (arg)); + tem = fold_ignored_result (arg); + if (TREE_CODE (tem) == GIMPLE_MODIFY_STMT) + return tem; + return fold_build1 (NOP_EXPR, type, tem); default: gcc_unreachable (); -- GitLab