diff gcc/testsuite/gcc.c-torture/execute/pr87290.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.c-torture/execute/pr87290.c	Thu Oct 25 07:37:49 2018 +0900
@@ -0,0 +1,63 @@
+/* PR middle-end/87290 */
+
+int c;
+
+__attribute__((noipa)) void
+f0 (void)
+{
+  c++;
+}
+
+__attribute__((noipa)) int
+f1 (int x)
+{
+  return x % 16 == 13;
+}
+
+__attribute__((noipa)) int
+f2 (int x)
+{
+  return x % 16 == -13;
+}
+
+__attribute__((noipa)) void
+f3 (int x)
+{
+  if (x % 16 == 13)
+    f0 ();
+}
+
+__attribute__((noipa)) void
+f4 (int x)
+{
+  if (x % 16 == -13)
+    f0 ();
+}
+
+int
+main ()
+{
+  int i, j;
+  for (i = -30; i < 30; i++)
+    {
+      if (f1 (13 + i * 16) != (i >= 0) || f2 (-13 + i * 16) != (i <= 0))
+	__builtin_abort ();
+      f3 (13 + i * 16);
+      if (c != (i >= 0))
+	__builtin_abort ();
+      f4 (-13 + i * 16);
+      if (c != 1 + (i == 0))
+	__builtin_abort ();
+      for (j = 1; j < 16; j++)
+	{
+	  if (f1 (13 + i * 16 + j) || f2 (-13 + i * 16 + j))
+	    __builtin_abort ();
+	  f3 (13 + i * 16 + j);
+	  f4 (-13 + i * 16 + j);
+	}
+      if (c != 1 + (i == 0))
+	__builtin_abort ();
+      c = 0;
+    }
+  return 0;
+}