aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/c_compiler/test.c
blob: ad3f48ccf9c1485ae8f8fb99490dd97457a219b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <assert.h>
#include <complex.h>
#include <stdio.h>
#include <stdlib.h>

typedef struct {
  int val;
} STest;

int getVal(STest* data) { return data->val; }

int main (int argc, char *argv[])
{
  STest* data = (STest*)malloc(sizeof(STest));
  data->val = 123;

  assert(getVal(data) != 456);
  int ok = (getVal(data) == 123);

  if (argc > 1) {
    fprintf(stdout, "val=%d\n", data->val);
  }

  free(data);

  if (!ok) abort();

  return EXIT_SUCCESS;
}