diff options
author | Roger Sayle <roger@eyesopen.com> | 2003-12-30 17:21:54 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2003-12-30 17:21:54 +0000 |
commit | 8bc6369b8b7ea630e70be3c6d1524090bbe2453f (patch) | |
tree | 3dc42bb1e1f0b5c9f923c27df3faddc782304cc3 /gcc | |
parent | 34998d6bb655f3270bc54656aa9519360100c2d8 (diff) | |
download | gcc-8bc6369b8b7ea630e70be3c6d1524090bbe2453f.zip gcc-8bc6369b8b7ea630e70be3c6d1524090bbe2453f.tar.gz gcc-8bc6369b8b7ea630e70be3c6d1524090bbe2453f.tar.bz2 |
fold-const.c (fold): Don't require strict type equality...
* fold-const.c (fold) <COND_EXPR>: Don't require strict type
equality, instead just prevent replacing a COND_EXPR of non-void
type by one of its operands of void type.
From-SVN: r75239
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a101019..20ca93e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-12-30 Roger Sayle <roger@eyesopen.com> + + * fold-const.c (fold) <COND_EXPR>: Don't require strict type + equality, instead just prevent replacing a COND_EXPR of non-void + type by one of its operands of void type. + 2003-12-30 Andreas Schwab <schwab@suse.de> * doc/c-tree.texi: Fix @item vs. @itemx. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5565932..7a939c4 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7869,7 +7869,8 @@ fold (tree expr) /* Only optimize constant conditions when the selected branch has the same type as the COND_EXPR. This avoids optimizing away "c ? x : throw", where the throw has a void type. */ - if (TREE_TYPE (tem) == TREE_TYPE (t)) + if (! VOID_TYPE_P (TREE_TYPE (tem)) + || VOID_TYPE_P (TREE_TYPE (t))) return pedantic_non_lvalue (tem); return t; } |