aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/Regression/C/gcc-c-torture/execute/pr43835.c
diff options
context:
space:
mode:
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/pr43835.c')
-rw-r--r--SingleSource/Regression/C/gcc-c-torture/execute/pr43835.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/pr43835.c b/SingleSource/Regression/C/gcc-c-torture/execute/pr43835.c
new file mode 100644
index 00000000..97237f62
--- /dev/null
+++ b/SingleSource/Regression/C/gcc-c-torture/execute/pr43835.c
@@ -0,0 +1,51 @@
+struct PMC {
+ unsigned flags;
+};
+
+typedef struct Pcc_cell
+{
+ struct PMC *p;
+ long bla;
+ long type;
+} Pcc_cell;
+
+extern void abort ();
+extern void Parrot_gc_mark_PMC_alive_fun(int * interp, struct PMC *pmc)
+ __attribute__((noinline));
+
+void Parrot_gc_mark_PMC_alive_fun (int * interp, struct PMC *pmc)
+{
+ abort ();
+}
+
+static void mark_cell(int * interp, Pcc_cell *c)
+ __attribute__((__nonnull__(1)))
+ __attribute__((__nonnull__(2)))
+ __attribute__((noinline));
+
+static void
+mark_cell(int * interp, Pcc_cell *c)
+{
+ if (c->type == 4 && c->p
+ && !(c->p->flags & (1<<18)))
+ Parrot_gc_mark_PMC_alive_fun(interp, c->p);
+}
+
+void foo(int * interp, Pcc_cell *c);
+
+void
+foo(int * interp, Pcc_cell *c)
+{
+ mark_cell(interp, c);
+}
+
+int main()
+{
+ int i;
+ Pcc_cell c;
+ c.p = 0;
+ c.bla = 42;
+ c.type = 4;
+ foo (&i, &c);
+ return 0;
+}