Commit 096dce1b by Richard Guenther Committed by Richard Biener

re PR middle-end/28045 (Bitfield, &&, and optimization => bad code generation)

2006-06-19  Richard Guenther  <rguenther@suse.de>

	PR middle-end/28045
	* fold-const.c (operand_equal_p): Check if the argument types
	have the same precision before stripping NOPs.

	* gcc.dg/torture/pr28045.c: New testcase.

From-SVN: r114772
parent 46b86adc
2006-06-19 Richard Guenther <rguenther@suse.de>
PR middle-end/28045
* fold-const.c (operand_equal_p): Check if the argument types
have the same precision before stripping NOPs.
2006-06-19 Daniel Berlin <dberlin@dberlin.org> 2006-06-19 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/27341 Fix PR tree-optimization/27341
......
...@@ -2497,6 +2497,11 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags) ...@@ -2497,6 +2497,11 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1))) if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1)))
return 0; return 0;
/* If both types don't have the same precision, then it is not safe
to strip NOPs. */
if (TYPE_PRECISION (TREE_TYPE (arg0)) != TYPE_PRECISION (TREE_TYPE (arg1)))
return 0;
STRIP_NOPS (arg0); STRIP_NOPS (arg0);
STRIP_NOPS (arg1); STRIP_NOPS (arg1);
......
2006-06-19 Richard Guenther <rguenther@suse.de>
PR middle-end/28045
* gcc.dg/torture/pr28045.c: New testcase.
2006-06-18 Francois-Xavier Coudert <coudert@clipper.ens.fr> 2006-06-18 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/26801 PR fortran/26801
/* { dg-do run } */
extern void abort(void);
struct a
{
unsigned int bits : 1;
signed long val : ((sizeof(long) * 8) - 1);
};
int Fnegate (struct a b)
{
if ((-((long)b.val)) <= ((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))
&& (-((long)b.val)) >= (-(((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))) - 1))
return 0 ;
abort ();
}
int main ()
{
struct a b = {1, 1};
Fnegate (b);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment