From 5229689d71b35d2e94c1c2f80147927bf5470c07 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 28 Oct 2008 11:34:51 +0100 Subject: [PATCH] re PR middle-end/37931 (ice: verify_gimple failed) PR middle-end/37931 * fold-const.c (distribute_bit_expr): Convert common, left and right arguments to type. * gcc.c-torture/execute/pr37931.c: New test. From-SVN: r141406 --- gcc/ChangeLog | 6 +++++ gcc/fold-const.c | 3 +++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.c-torture/execute/pr37931.c | 23 +++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr37931.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 44432df823c..d04aa06a81c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-10-28 Jakub Jelinek + + PR middle-end/37931 + * fold-const.c (distribute_bit_expr): Convert common, left and + right arguments to type. + 2008-10-28 Nick Clifton * config/mn10300/mn10300.h (CALL_REALLY_USED_REGISTERS): Define. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1eac946e31b..7a215d27cb4 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3806,6 +3806,9 @@ distribute_bit_expr (enum tree_code code, tree type, tree arg0, tree arg1) else return 0; + common = fold_convert (type, common); + left = fold_convert (type, left); + right = fold_convert (type, right); return fold_build2 (TREE_CODE (arg0), type, common, fold_build2 (code, type, left, right)); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3aa9a1e7125..58e7819496a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-10-28 Jakub Jelinek + + PR middle-end/37931 + * gcc.c-torture/execute/pr37931.c: New test. + 2008-10-27 Jakub Jelinek PR tree-optimization/37879 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr37931.c b/gcc/testsuite/gcc.c-torture/execute/pr37931.c new file mode 100644 index 00000000000..0077a21ba33 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr37931.c @@ -0,0 +1,23 @@ +/* PR middle-end/37931 */ + +extern void abort (void); + +int +foo (int a, unsigned int b) +{ + return (a | 1) & (b | 1); +} + +int +main (void) +{ + if (foo (6, 0xc6) != 7) + abort (); + if (foo (0x80, 0xc1) != 0x81) + abort (); + if (foo (4, 4) != 5) + abort (); + if (foo (5, 4) != 5) + abort (); + return 0; +}