summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/pr46856.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/compile/pr46856.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr46856.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46856.c b/gcc/testsuite/gcc.c-torture/compile/pr46856.c
new file mode 100644
index 000000000..2ec5e8baf
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr46856.c
@@ -0,0 +1,26 @@
+struct data {
+ int prio;
+ signed char status;
+};
+
+struct base {
+ unsigned _num;
+ struct data vec[10];
+};
+
+static struct data *ix(struct base *base, unsigned i)
+{
+ return &base->vec[i];
+}
+
+struct heap {
+ struct base base;
+};
+
+struct heap *heap;
+
+void increase_insn_priority (int *fld, int amount)
+{
+ if (ix(heap ? &heap->base : 0, *fld)->status > 0)
+ ix(heap ? &heap->base : 0, *fld)->prio += amount;
+}