aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/4080945a.C
blob: 6a46a9e3d09eaf9505a55662a30756de8ebabee9 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* APPLE LOCAL file 4080945 / PR 20742 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/**********************************************************************/

extern int Loop1Max,Loop2Max;
void bar(int a, int b, int c);
void foo(int parm);

/**********************************************************************/

#define x7(x) x;x;x;x;x;x;x
#define REPL(x) x7(x);x7(x);x7(x);x7(x);x7(x);x7(x)	
	// 6 * 7 = 42 (0.06 seconds compile-time for GCC 3.3, 1 year for GCC 4.0)
	// Changing REPL from 42 to 21 will reduce GCC 4.0 compile-time to 20 seconds.

/**********************************************************************/
void foo(int parm)
{
	register int x,y;
	register int a,b,c;

	a = b = c = parm;

	for (y=0; y<Loop2Max; ++y)
	{
		for (x=0; x<Loop1Max; ++x)
		{
			REPL
			(
				a = c * a;
				b = a * b;
				c = parm - a;
			);
		}
	}

	bar(a,b,c);

	return;
}

/**********************************************************************/