summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr39867.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr39867.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr39867.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr39867.c b/gcc/testsuite/gcc.dg/pr39867.c
new file mode 100644
index 000000000..cb7972452
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr39867.c
@@ -0,0 +1,12 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+int main (void)
+{
+ int exp = -1;
+ /* Wrong folding of the LHS to an unsigned MAX leads to 4294967295 != 2. */
+ if ((exp < 2 ? 2U : (unsigned int) exp) != 2)
+ link_error ();
+ return 0;
+}
+