zig/test/standalone/c_compiler/test.c
Alexander Slesarev 3997828a61 Added _LIBCPP_HAS_NO_THREADS for single_threaded binaries linked with libcxx.
Fixed single-threaded mode for Windows.
2022-05-10 16:40:48 -07:00

29 lines
442 B
C

#include <assert.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;
}