shithub: scc

ref: 43a3b37a514e390199668bab42c3451901de5917
dir: /cc1/tests/test002.c/

View raw version
/*
name: TEST002
description: Test forward references before definition of types
error:

output:
G4	P	x
F7	I
G8	F7	main
{
\
S2	S
M5	I	i
M6	P	next
A9	S2	y
A10	P	p
A11	N	n
	A9	M5	.I	#I0	:I
	G4	@S2	A9	:S2
	A11	#N0	:N	A10	A9	'P	:P	,P
	j	L14
	e
L12
	A11	#N1	:+N	A10	A10	@S2	M6	.P	:P	,P
L14
	j	L12	A10	#P0	!I
	b
L13
}

*/

struct S *x;
struct S {
	int i;
	struct S *next;
};

int
main(void)
{
	struct S y, *p;
	unsigned n;

	y.i = 0;
	*x = y;

	for (n = 0, p = &y; p; ++n, p = p->next)
		/* nothing */;
}