From 16997bc01128f46cee9450237cd5e3e8fb3b12ad Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 23 Apr 2011 12:18:03 +0200 Subject: [PATCH] re PR c/48685 (ICE in gimplify_expr, at gimplify.c:7034) PR c/48685 * fold-const.c (fold_convert_loc): Add NOP_EXPR when casting to VOID_TYPE even around MODIFY_EXPR. * gcc.dg/pr48685.c: New test. From-SVN: r172895 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 2 -- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr48685.c | 11 +++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr48685.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index edff5052b18..4d7c511ccbe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-04-23 Jakub Jelinek + + PR c/48685 + * fold-const.c (fold_convert_loc): Add NOP_EXPR when casting + to VOID_TYPE even around MODIFY_EXPR. + 2011-04-22 Mike Stump * gensupport.c (read_md_rtx): Fix typo in comment. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c4bf08819b3..8f90f6f108a 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2029,8 +2029,6 @@ fold_convert_loc (location_t loc, tree type, tree arg) case VOID_TYPE: tem = fold_ignored_result (arg); - if (TREE_CODE (tem) == MODIFY_EXPR) - goto fold_convert_exit; return fold_build1_loc (loc, NOP_EXPR, type, tem); default: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 40b9e6d5900..08aa6d48241 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-04-23 Jakub Jelinek + + PR c/48685 + * gcc.dg/pr48685.c: New test. + 2011-04-22 Jan Hubicka * gcc.dg/tree-ssa/pr38699.c: Fix testcase. diff --git a/gcc/testsuite/gcc.dg/pr48685.c b/gcc/testsuite/gcc.dg/pr48685.c new file mode 100644 index 00000000000..36df0cc5f31 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48685.c @@ -0,0 +1,11 @@ +/* PR c/48685 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int +main () +{ + int v = 1; + (void) (1 == 2 ? (void) 0 : (v = 0)); + return v; +} -- 2.30.2