aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@gmail.com>2023-10-18 10:26:07 -0700
committerAndrew Pinski <pinskia@gmail.com>2023-10-18 15:11:39 -0700
commitb20dbddcc41120144e700c4e3ef1ec396b1c56ab (patch)
treed612635f4d31e26444dd1ab56e7e9f15d9e57719 /gcc/testsuite
parent879c91fcccf93681bd7e13290bfbb384cadcd268 (diff)
downloadgcc-b20dbddcc41120144e700c4e3ef1ec396b1c56ab.zip
gcc-b20dbddcc41120144e700c4e3ef1ec396b1c56ab.tar.gz
gcc-b20dbddcc41120144e700c4e3ef1ec396b1c56ab.tar.bz2
Fix expansion of `(a & 2) != 1`
I had a thinko in r14-1600-ge60593f3881c72a96a3fa4844d73e8a2cd14f670 where we would remove the `& CST` part if we ended up not calling expand_single_bit_test. This fixes the problem by introducing a new variable that will be used for calling expand_single_bit_test. As afar as I know this can only show up when disabling optimization passes as this above form would have been optimized away. Committed as obvious after a bootstrap/test on x86_64-linux-gnu. PR middle-end/111863 gcc/ChangeLog: * expr.cc (do_store_flag): Don't over write arg0 when stripping off `& POW2`. gcc/testsuite/ChangeLog: * gcc.c-torture/execute/pr111863-1.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr111863-1.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr111863-1.c b/gcc/testsuite/gcc.c-torture/execute/pr111863-1.c
new file mode 100644
index 0000000..4e27fe6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr111863-1.c
@@ -0,0 +1,16 @@
+/* { dg-options " -fno-tree-ccp -fno-tree-dominator-opts -fno-tree-vrp" } */
+
+__attribute__((noipa))
+int f(int a)
+{
+ a &= 2;
+ return a != 1;
+}
+int main(void)
+{
+ int t = f(1);
+ if (!t)
+ __builtin_abort();
+ __builtin_printf("%d\n",t);
+ return 0;
+}