summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/guality/pr58791-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/guality/pr58791-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr58791-1.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/guality/pr58791-1.c b/gcc/testsuite/gcc.dg/guality/pr58791-1.c
new file mode 100644
index 00000000000..62ce881bfc2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/guality/pr58791-1.c
@@ -0,0 +1,34 @@
+/* PR tree-optimization/58791 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+#include "../nop.h"
+
+__attribute__((noinline, noclone)) int
+foo (int x, int y)
+{
+ _Bool a = x != 0;
+ _Bool b = y != 2;
+ _Bool c = a & b;
+ _Bool d = !c;
+ int ret;
+ if (c)
+ {
+ if (y < 3 || y > 4)
+ ret = 1;
+ else
+ ret = 0;
+ }
+ else
+ ret = 0;
+ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr58791-1.c:25 "c & 1" "1" } } */
+ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr58791-1.c:25 "d & 1" "0" } } */
+ return ret;
+}
+
+int
+main ()
+{
+ foo (1, 3);
+ return 0;
+}