summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr30185.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr30185.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr30185.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr30185.c b/gcc/testsuite/gcc.c-torture/execute/pr30185.c
new file mode 100644
index 000000000..3e974ce57
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr30185.c
@@ -0,0 +1,28 @@
+/* PR target/30185 */
+
+extern void abort (void);
+
+typedef struct S { char a; long long b; } S;
+
+S
+foo (S x, S y)
+{
+ S z;
+ z.b = x.b / y.b;
+ return z;
+}
+
+int
+main (void)
+{
+ S a, b;
+ a.b = 32LL;
+ b.b = 4LL;
+ if (foo (a, b).b != 8LL)
+ abort ();
+ a.b = -8LL;
+ b.b = -2LL;
+ if (foo (a, b).b != 4LL)
+ abort ();
+ return 0;
+}