re PR tree-optimization/31136 (FRE ignores bit-field truncation (C and C++ front-end don't produce bit-field truncation)

2007-04-21  Richard Guenther  <rguenther@suse.de>

	PR middle-end/31136
	* fold-const.c (fold_unary): Call fold_convert_const on the
	original tree.

	* gcc.c-torture/execute/pr31136.c: New testcase.

From-SVN: r124020
This commit is contained in:
Richard Guenther 2007-04-21 17:47:13 +00:00 committed by Richard Biener
parent fc52a1446b
commit 84ece8efd2
4 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-04-21 Richard Guenther <rguenther@suse.de>
PR middle-end/31136
* fold-const.c (fold_unary): Call fold_convert_const on the
original tree.
2007-04-21 Alexandre Oliva <aoliva@redhat.com>
* gcse.c (store_killed_in_insn): Handle PARALLELs.

View File

@ -7857,7 +7857,7 @@ fold_unary (enum tree_code code, tree type, tree op0)
return fold_build1 (BIT_NOT_EXPR, type, fold_convert (type, tem));
}
tem = fold_convert_const (code, type, arg0);
tem = fold_convert_const (code, type, op0);
return tem ? tem : NULL_TREE;
case VIEW_CONVERT_EXPR:

View File

@ -1,3 +1,8 @@
2007-04-21 Richard Guenther <rguenther@suse.de>
PR middle-end/31136
* gcc.c-torture/execute/pr31136.c: New testcase.
2007-04-21 Alexandre Oliva <aoliva@redhat.com>
* gcc.target/i386/movsi-sm-1.c: New.

View File

@ -0,0 +1,17 @@
extern void abort (void);
struct S {
unsigned b4:4;
unsigned b6:6;
} s;
int main()
{
s.b6 = 31;
s.b4 = s.b6;
s.b6 = s.b4;
if (s.b6 != 15)
abort ();
return 0;
}