aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr91450-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr91450-2.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr91450-2.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr91450-2.c b/gcc/testsuite/gcc.c-torture/execute/pr91450-2.c
new file mode 100644
index 000000000000..bfaabbb5ac65
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr91450-2.c
@@ -0,0 +1,76 @@
+/* PR middle-end/91450 */
+
+__attribute__((noipa)) void
+foo (int a, int b)
+{
+ unsigned long long r;
+ if (__builtin_mul_overflow (a, b, &r))
+ __builtin_abort ();
+ if (r != 0)
+ __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+bar (int a, int b)
+{
+ unsigned long long r;
+ if (a >= 0)
+ return;
+ if (__builtin_mul_overflow (a, b, &r))
+ __builtin_abort ();
+ if (r != 0)
+ __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+baz (int a, int b)
+{
+ unsigned long long r;
+ if (b >= 0)
+ return;
+ if (__builtin_mul_overflow (a, b, &r))
+ __builtin_abort ();
+ if (r != 0)
+ __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+qux (int a, int b)
+{
+ unsigned long long r;
+ if (a >= 0)
+ return;
+ if (b < 0)
+ return;
+ if (__builtin_mul_overflow (a, b, &r))
+ __builtin_abort ();
+ if (r != 0)
+ __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+quux (int a, int b)
+{
+ unsigned long long r;
+ if (a < 0)
+ return;
+ if (b >= 0)
+ return;
+ if (__builtin_mul_overflow (a, b, &r))
+ __builtin_abort ();
+ if (r != 0)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ foo (-4, 0);
+ foo (0, -4);
+ foo (0, 0);
+ bar (-4, 0);
+ baz (0, -4);
+ qux (-4, 0);
+ quux (0, -4);
+ return 0;
+}