From: rguenth Date: Wed, 9 Jan 2008 15:46:49 +0000 (+0000) Subject: 2008-01-09 Richard Guenther X-Git-Tag: upstream/4.9.2~44245 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8b8bad78c480f242bda3c0a9db4657cde706ad7;p=platform%2Fupstream%2Flinaro-gcc.git 2008-01-09 Richard Guenther Andrew Pinski PR middle-end/30132 * gimplify.c (gimplify_cond_expr): Do not create an addressable temporary if an rvalue is ok or an lvalue is not required. * gcc.c-torture/compile/pr30132.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131430 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index acfca73..bfdeb65 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,11 @@ 2008-01-09 Richard Guenther + Andrew Pinski + + PR middle-end/30132 + * gimplify.c (gimplify_cond_expr): Do not create an addressable + temporary if an rvalue is ok or an lvalue is not required. + +2008-01-09 Richard Guenther PR middle-end/34458 * tree-data-ref.c (initialize_matrix_A): Use tree_low_cst, diff --git a/gcc/gimplify.c b/gcc/gimplify.c index dd83222..5254741 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2633,7 +2633,11 @@ gimplify_cond_expr (tree *expr_p, tree *pre_p, fallback_t fallback) { tree result; - if ((fallback & fb_lvalue) == 0) + /* If an rvalue is ok or we do not require an lvalue, avoid creating + an addressable temporary. */ + if (((fallback & fb_rvalue) + || !(fallback & fb_lvalue)) + && !TREE_ADDRESSABLE (type)) { if (gimplify_ctxp->allow_rhs_cond_expr /* If either branch has side effects or could trap, it can't be diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 78f5439..3201f9e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,10 @@ 2008-01-09 Richard Guenther + Andrew Pinski + + PR middle-end/30132 + * gcc.c-torture/compile/pr30132.c: New testcase. + +2008-01-09 Richard Guenther PR middle-end/34458 * gcc.c-torture/compile/pr34458.c: New testcase. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30132.c b/gcc/testsuite/gcc.c-torture/compile/pr30132.c new file mode 100644 index 0000000..adffae7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30132.c @@ -0,0 +1,5 @@ +double testit(double _Complex* t) +{ + return *t==0.0?0.0:-*t; +} +