This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Proposed testcase for PR 7344


This is intended to go in the gcc.dg directory.  Comments welcome, since 
I'm pretty new to testsuite work.  I titled it switch-2.c since I don't 
like the by-date naming convention, and it's a pretty generic test.

	* gcc.dg/switch-2.c: New test.
/* Make sure enormous switches compile in a reasonable amount of time.  This
   makes a 10,000 case switch.  See e.g. PR 7344. */

/* { dg-do compile } */
/* { dg-options "-O0" } */

#define CL0(a) case a: f(); goto c;
#define CL1(a) CL0(a##0) CL0(a##1) CL0(a##2) CL0(a##3) CL0(a##4) CL0(a##5) CL0(a##6) CL0(a##7) CL0(a##8) CL0(a##9)
#define CL2(a) CL1(a##0) CL1(a##1) CL1(a##2) CL1(a##3) CL1(a##4) CL1(a##5) CL1(a##6) CL1(a##7) CL1(a##8) CL1(a##9)
#define CL3(a) CL2(a##0) CL2(a##1) CL2(a##2) CL2(a##3) CL2(a##4) CL2(a##5) CL2(a##6) CL2(a##7) CL2(a##8) CL2(a##9)
#define CL4(a) CL3(a##0) CL3(a##1) CL3(a##2) CL3(a##3) CL3(a##4) CL3(a##5) CL3(a##6) CL3(a##7) CL3(a##8) CL3(a##9)
 
void f();

void a() {
    int b;
 c: switch (b) {
        CL4(1)
    }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]