aboutsummaryrefslogtreecommitdiffstats
path: root/test/CFrontend/2008-01-26-ReadOnlyByVal.c
blob: cea6d1e15224c77c92c5990a9ed8ca67743ba4f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// RUN: %llvmgcc %s -S -O1 -o - | llvm-as | opt -std-compile-opts | llvm-dis | not grep add

struct S { int A; int B; int C; int D; };

int f(struct S x) __attribute__ ((const));

static int __attribute__ ((const)) g(struct S x) {
	x.A = x.B;
	return f(x);
}

int h(void) {
	struct S x;
	int r;
	x.A = 0;
	x.B = 9;
	r = g(x);
	return r + x.A;
}