aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/match.pd3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr10352-1.c12
2 files changed, 13 insertions, 2 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index cdab5e5..986b052 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -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));
}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr10352-1.c b/gcc/testsuite/gcc.c-torture/execute/pr10352-1.c
new file mode 100644
index 0000000..babb9d4
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr10352-1.c
@@ -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;
+}