[Committed] Fix tree-optimization/103152: Still one more -signed1bit issue

When I fixed PR 102622, I accidently left behind a TYPE_PRECISION
check which I had there for checking before hand.  This check
is not needed as the code will handle it correctly anyways.

Committed as obvious after a bootstrap/test on x86_64-linux-gnu.

	PR tree-optimization/10352

gcc/ChangeLog:

	* match.pd: Remove check of TYPE_PRECISION for
	the a?0:pow2 case.

gcc/testsuite/ChangeLog:

	* gcc.c-torture/execute/pr10352-1.c: New test.
This commit is contained in:
Andrew Pinski 2021-11-09 09:56:10 +00:00
parent 56af35de3d
commit f7844b6a77
2 changed files with 13 additions and 2 deletions

View File

@ -4056,8 +4056,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(if (integer_onep (@2))
(convert (bit_xor (convert:boolean_type_node @0) { booltrue; } )))
/* a ? powerof2cst : 0 -> (!a) << (log2(powerof2cst)) */
(if (INTEGRAL_TYPE_P (type) && integer_pow2p (@2)
&& TYPE_PRECISION (type) != 1)
(if (INTEGRAL_TYPE_P (type) && integer_pow2p (@2))
(with {
tree shift = build_int_cst (integer_type_node, tree_log2 (@2));
}

View File

@ -0,0 +1,12 @@
/* this is another case where phiopt
would create -signed1bit which is undefined. */
struct {
int a:1;
} b;
int *c = (int *)&b, d;
int main() {
d = c && (b.a = (d < 0) ^ 3);
if (d != 1)
__builtin_abort();
return 0;
}