summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/compare10.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/compare10.c')
-rw-r--r--gcc/testsuite/gcc.dg/compare10.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/compare10.c b/gcc/testsuite/gcc.dg/compare10.c
new file mode 100644
index 000000000..3b8af28bf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compare10.c
@@ -0,0 +1,16 @@
+/* Test for bogus -Wsign-compare warnings that appeared when not
+ folding operands before warning. */
+/* { dg-do compile } */
+/* { dg-options "-Wsign-compare" } */
+
+int
+test_compare (int a, unsigned b)
+{
+ return (b > 8 * (a ? 4 : 8));
+}
+
+unsigned int
+test_conditional (int a, unsigned b, int c)
+{
+ return (c ? b : 8 * (a ? 4 : 8));
+}