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
This commit is contained in:
Jakub Jelinek 2008-10-28 11:34:51 +01:00 committed by Jakub Jelinek
parent 9d54866d54
commit 5229689d71
4 changed files with 37 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2008-10-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/37931
* fold-const.c (distribute_bit_expr): Convert common, left and
right arguments to type.
2008-10-28 Nick Clifton <nickc@redhat.com> 2008-10-28 Nick Clifton <nickc@redhat.com>
* config/mn10300/mn10300.h (CALL_REALLY_USED_REGISTERS): Define. * config/mn10300/mn10300.h (CALL_REALLY_USED_REGISTERS): Define.

View File

@ -3806,6 +3806,9 @@ distribute_bit_expr (enum tree_code code, tree type, tree arg0, tree arg1)
else else
return 0; 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, return fold_build2 (TREE_CODE (arg0), type, common,
fold_build2 (code, type, left, right)); fold_build2 (code, type, left, right));
} }

View File

@ -1,3 +1,8 @@
2008-10-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/37931
* gcc.c-torture/execute/pr37931.c: New test.
2008-10-27 Jakub Jelinek <jakub@redhat.com> 2008-10-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/37879 PR tree-optimization/37879

View File

@ -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;
}