1*c85f09ccSJohn Levon struct s {
2*c85f09ccSJohn Levon 	int c;
3*c85f09ccSJohn Levon 	int a[];
4*c85f09ccSJohn Levon } s;
5*c85f09ccSJohn Levon int f;
6*c85f09ccSJohn Levon 
7*c85f09ccSJohn Levon void fun(void);
foo(void)8*c85f09ccSJohn Levon void foo(void)
9*c85f09ccSJohn Levon {
10*c85f09ccSJohn Levon 	for (f = 1;;)
11*c85f09ccSJohn Levon 		if (s.a[f])
12*c85f09ccSJohn Levon 			fun();
13*c85f09ccSJohn Levon }
14*c85f09ccSJohn Levon 
15*c85f09ccSJohn Levon /*
16*c85f09ccSJohn Levon  * check-name: global var as loop index
17*c85f09ccSJohn Levon  * check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
18*c85f09ccSJohn Levon  * check-output-ignore
19*c85f09ccSJohn Levon  * check-output-contains: load\\..*\\[f\\]
20*c85f09ccSJohn Levon  */
21