mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-28 06:14:10 +08:00
re PR middle-end/38771 (error: non-trivial conversion in unary operation)
PR middle-end/38771 * fold-const.c (fold_unary): For COMPOUND_EXPR and COND_EXPR, fold_convert arg0 operands to TREE_TYPE (op0) first. * gcc.c-torture/compile/pr38771.c: New test. From-SVN: r143202
This commit is contained in:
parent
76601ca966
commit
4017e262b6
@ -1,3 +1,9 @@
|
||||
2009-01-09 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/38771
|
||||
* fold-const.c (fold_unary): For COMPOUND_EXPR and COND_EXPR,
|
||||
fold_convert arg0 operands to TREE_TYPE (op0) first.
|
||||
|
||||
2009-01-08 Vladimir Makarov <vmakarov@redhat.com>
|
||||
|
||||
* params.def (ira-max-conflict-table-size): Decrease default value
|
||||
|
@ -8053,15 +8053,19 @@ fold_unary (enum tree_code code, tree type, tree op0)
|
||||
{
|
||||
if (TREE_CODE (arg0) == COMPOUND_EXPR)
|
||||
return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
|
||||
fold_build1 (code, type, TREE_OPERAND (arg0, 1)));
|
||||
fold_build1 (code, type,
|
||||
fold_convert (TREE_TYPE (op0),
|
||||
TREE_OPERAND (arg0, 1))));
|
||||
else if (TREE_CODE (arg0) == COND_EXPR)
|
||||
{
|
||||
tree arg01 = TREE_OPERAND (arg0, 1);
|
||||
tree arg02 = TREE_OPERAND (arg0, 2);
|
||||
if (! VOID_TYPE_P (TREE_TYPE (arg01)))
|
||||
arg01 = fold_build1 (code, type, arg01);
|
||||
arg01 = fold_build1 (code, type,
|
||||
fold_convert (TREE_TYPE (op0), arg01));
|
||||
if (! VOID_TYPE_P (TREE_TYPE (arg02)))
|
||||
arg02 = fold_build1 (code, type, arg02);
|
||||
arg02 = fold_build1 (code, type,
|
||||
fold_convert (TREE_TYPE (op0), arg02));
|
||||
tem = fold_build3 (COND_EXPR, type, TREE_OPERAND (arg0, 0),
|
||||
arg01, arg02);
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2009-01-09 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/38771
|
||||
* gcc.c-torture/compile/pr38771.c: New test.
|
||||
|
||||
2009-01-08 Nathan Froyd <froydnj@codesourcery.com>
|
||||
|
||||
* gcc.dg/pr34856.c: Ignore irrelevant warning.
|
||||
|
7
gcc/testsuite/gcc.c-torture/compile/pr38771.c
Normal file
7
gcc/testsuite/gcc.c-torture/compile/pr38771.c
Normal file
@ -0,0 +1,7 @@
|
||||
/* PR middle-end/38771 */
|
||||
|
||||
unsigned long long
|
||||
foo (long long x)
|
||||
{
|
||||
return -(unsigned long long) (x ? : x);
|
||||
}
|
Loading…
Reference in New Issue
Block a user