1/*
2 * Copyright 2014, NICTA
3 *
4 * This software may be distributed and modified according to the terms of
5 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
6 * See "LICENSE_BSD2.txt" for details.
7 *
8 * @TAG(NICTA_BSD)
9 */
10
11/*
12 * Simple test cases for heap_abs_syntax feature.
13 * JIRA issue ID: VER-356
14 */
15
16struct thing {
17  int x;
18  int *p;
19  struct thing *left;
20  struct thing *right;
21};
22
23struct list {
24  int x;
25  struct list *p;
26};
27
28void f1(struct thing *t) {
29  *t->p = 42;
30}
31
32void f2(struct thing *t) {
33  t->x = 42;
34}
35
36void f3(struct thing *t) {
37  t->right = t->left + 1;
38}
39
40void f4(struct thing *t) {
41  t->left = t;
42}
43
44void f5(struct thing *p, struct thing t) {
45  *p = t;
46}
47
48/* Signed word updates are still not translated correctly. */
49void f6(long long *p) {
50  *p = 42;
51}
52
53void f7(unsigned long long *p) {
54  *p = 42;
55}
56
57int f8(struct list *l, struct thing *t) {
58  return l->p->x && t->left->right->x;
59}
60