tests for compiler (non-)limits
Geoffrey Keating
gkeating@apple.com
Tue Apr 24 05:52:00 GMT 2007
In 5.4.2.1 in the C standard, there's a list of "translation limits".
The GNU coding standard says that a GNU program should "Avoid
arbitrary limits" and so does the C standard, and indeed GCC is
supposed to avoid most of these limits. (There are one or two limits
that are necessary to prevent run-away in the preprocessor.)
So, this patch adds a number of testcases which verify that there is
at least one program which significantly exceeds a minimum limit in
the C standard and which GCC can compile.
I'm a little disappointed in this particular group of testcases. I
originally wrote them for GCC 4.0, running on a 450Mhz G4 with 256Mb
of RAM, and they all ran correctly and reasonably quickly. When I
came to re-check them against mainline, on a 2Ghz G5 with 512Mb of RAM
(not a new or state-of-the-art machine), many of them didn't work at
all and some were much slower. The ones that didn't work at all
appear to be due to the new recursive-descent parser needing much more
stack space; I'm not sure about the slowdowns yet. I 'fixed' the
problem by reducing the problematic testcases to 10,000 instead of the
original 100,000. I think it's important to have them in dejagnu
so that they don't regress further.
The limits tested are:
* 127 nesting levels of blocks: limits-blocks.c (10,000)
* 12 pointer, array, and function declarators (in any combinations)
modifying an arithmetic, structure, union, or incomplete type in a
declaration: limits-pointer.c (10,000)
* 63 nesting levels of parenthesized declarators within a full
declarator: limits-declparen.c (10,000)
* 63 nesting levels of parenthesized expressions within a full
expression: limits-exprparen.c (10,000)
* 63 significant initial characters in an internal identifier or a
macro name: limits-idinternal.c (1,000,000)
* 31 significant initial characters in an external identifier:
limits-idexternal.c (10,000)
* 4095 external identifiers in one translation unit:
limits-externalid.c (100,000)
* 511 identifiers with block scope declared in one block:
limits-blockid.c (100,000)
* 127 parameters in one function definition: limits-fndefn.c (100,000)
* 127 arguments in one function call: limits-fnargs.c (10,000)
* 4095 characters in a character string literal or wide string literal
(after concatenation): limits-stringlit.c (100,000,000)
[I believe this also tests "65535 bytes in an object (in a hosted
environment only)". It probably shouldn't.]
* 1023 case labels for a switch statement (excluding those for
any nested switch statements): limits-caselabels.c (100,000)
* 1023 members in a single structure or union: limits-structmem.c (10,000)
* 1023 enumeration constants in a single enumeration:
limits-enumconst.c (100,000)
* 63 levels of nested structure or union definitions in a single
struct-declaration-list: limits-structnest.c (10,000)
The missing tests are all preprocessor-related, and unlike these tests
might need to be fairly large files:
* 63 nesting levels of conditional inclusion
* 4095 macro identifiers simultaneously defined in one preprocessing
translation unit
* 4095 characters in a logical source line
* 15 nesting levels for #included files
I believe there are tests for some of these with the preprocessor
testcases.
For strict conformance, you really should try to link all of these
testcases into a single executable, but these tests are just trying to
test the compiler (and, a little bit, the assembler) so I didn't do
that.
Tested by running 'make check-gcc' for just these files.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/gcc-testsuite-limits.patch================
2007-04-12 Geoffrey Keating <geoffk@apple.com>
* gcc.c-torture/compile/limits-blockid.c: New.
* gcc.c-torture/compile/limits-blocks.c: New.
* gcc.c-torture/compile/limits-caselabels.c: New.
* gcc.c-torture/compile/limits-declparen.c: New.
* gcc.c-torture/compile/limits-enumconst.c: New.
* gcc.c-torture/compile/limits-exprparen.c: New.
* gcc.c-torture/compile/limits-externalid.c: New.
* gcc.c-torture/compile/limits-fnargs.c: New.
* gcc.c-torture/compile/limits-fndefn.c: New.
* gcc.c-torture/compile/limits-idexternal.c: New.
* gcc.c-torture/compile/limits-idinternal.c: New.
* gcc.c-torture/compile/limits-pointer.c: New.
* gcc.c-torture/compile/limits-stringlit.c: New.
* gcc.c-torture/compile/limits-structmem.c: New.
* gcc.c-torture/compile/limits-structnest.c: New.
Index: testsuite/gcc.c-torture/compile/limits-structmem.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-structmem.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-structmem.c (revision 0)
@@ -0,0 +1,18 @@
+#define LIM1(x) x##0; x##1; x##2; x##3; x##4; x##5; x##6; x##7; x##8; x##9;
+#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \
+ LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9)
+#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \
+ LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9)
+#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \
+ LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9)
+#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \
+ LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9)
+#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \
+ LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9)
+#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \
+ LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9)
+
+struct q20_struct
+{
+ LIM4 (char m)
+};
Index: testsuite/gcc.c-torture/compile/limits-enumconst.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-enumconst.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-enumconst.c (revision 0)
@@ -0,0 +1,18 @@
+#define LIM1(x) x##0, x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8, x##9,
+#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \
+ LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9)
+#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \
+ LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9)
+#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \
+ LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9)
+#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \
+ LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9)
+#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \
+ LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9)
+#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \
+ LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9)
+
+enum q21_enum
+{
+ LIM5 (e)
+};
Index: testsuite/gcc.c-torture/compile/limits-stringlit.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-stringlit.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-stringlit.c (revision 0)
@@ -0,0 +1,10 @@
+#define STR2 "012345678901234567890123456789012345678901234567890123456789\
+0123456789012345678901234567890123456789"
+#define STR3 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2
+#define STR4 STR3 STR3 STR3 STR3 STR3 STR3 STR3 STR3 STR3 STR3
+#define STR5 STR4 STR4 STR4 STR4 STR4 STR4 STR4 STR4 STR4 STR4
+#define STR6 STR5 STR5 STR5 STR5 STR5 STR5 STR5 STR5 STR5 STR5
+#define STR7 STR6 STR6 STR6 STR6 STR6 STR6 STR6 STR6 STR6 STR6
+#define STR8 STR7 STR7 STR7 STR7 STR7 STR7 STR7 STR7 STR7 STR7
+
+char vlv[] = STR8;
Index: testsuite/gcc.c-torture/compile/limits-fndefn.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-fndefn.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-fndefn.c (revision 0)
@@ -0,0 +1,17 @@
+#define LIM1(x) x##0, x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8, x##9,
+#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \
+ LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9)
+#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \
+ LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9)
+#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \
+ LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9)
+#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \
+ LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9)
+#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \
+ LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9)
+#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \
+ LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9)
+
+void func1 (LIM5(int p) int t)
+{
+}
Index: testsuite/gcc.c-torture/compile/limits-blocks.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-blocks.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-blocks.c (revision 0)
@@ -0,0 +1,12 @@
+#define IF1 \
+ if (x) if (x) if (x) if (x) if (x) if (x) if (x) if (x) if (x) if (x)
+#define IF2 IF1 IF1 IF1 IF1 IF1 IF1 IF1 IF1 IF1 IF1
+#define IF3 IF2 IF2 IF2 IF2 IF2 IF2 IF2 IF2 IF2 IF2
+#define IF4 IF3 IF3 IF3 IF3 IF3 IF3 IF3 IF3 IF3 IF3
+#define IF5 IF4 IF4 IF4 IF4 IF4 IF4 IF4 IF4 IF4 IF4
+
+int func_q1 (int x)
+{
+ IF4 return 0;
+ return 2;
+}
Index: testsuite/gcc.c-torture/compile/limits-structnest.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-structnest.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-structnest.c (revision 0)
@@ -0,0 +1,23 @@
+#define LIM1(x) x##0 {x##1 {x##2 {x##3 {x##4 {x##5 {x##6 {x##7 {x##8 {x##9 {
+#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \
+ LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9)
+#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \
+ LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9)
+#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \
+ LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9)
+#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \
+ LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9)
+#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \
+ LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9)
+#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \
+ LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9)
+
+#define RBR1 } x; } x; } x; } x; } x; } x; } x; } x; } x; } x;
+#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1
+#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2
+#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3
+#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4
+
+LIM4(struct s)
+ int x;
+RBR4
Index: testsuite/gcc.c-torture/compile/limits-externalid.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-externalid.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-externalid.c (revision 0)
@@ -0,0 +1,15 @@
+#define LIM1(x) x##0; x##1; x##2; x##3; x##4; x##5; x##6; x##7; x##8; x##9;
+#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \
+ LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9)
+#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \
+ LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9)
+#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \
+ LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9)
+#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \
+ LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9)
+#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \
+ LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9)
+#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \
+ LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9)
+
+LIM5(char t)
Index: testsuite/gcc.c-torture/compile/limits-idexternal.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-idexternal.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-idexternal.c (revision 0)
@@ -0,0 +1,11 @@
+#define LIM1 0123456789
+#define LIM2 LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1
+#define LIM3 LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2
+#define LIM4 LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3
+#define LIM5 LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4
+#define LIM6 LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5
+
+#define V(x) v##LIM4##x
+
+int V(a);
+int V(b);
Index: testsuite/gcc.c-torture/compile/limits-blockid.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-blockid.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-blockid.c (revision 0)
@@ -0,0 +1,18 @@
+#define LIM1(x) x##0; x##1; x##2; x##3; x##4; x##5; x##6; x##7; x##8; x##9;
+#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \
+ LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9)
+#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \
+ LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9)
+#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \
+ LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9)
+#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \
+ LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9)
+#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \
+ LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9)
+#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \
+ LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9)
+
+void q9_func(void)
+{
+ LIM5(char t)
+}
Index: testsuite/gcc.c-torture/compile/limits-declparen.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-declparen.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-declparen.c (revision 0)
@@ -0,0 +1,15 @@
+#define PTR1 (* (* (* (* (* (* (* (* (* (*
+#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1
+#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2
+#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3
+#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4
+#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5
+
+#define RBR1 ) ) ) ) ) ) ) ) ) )
+#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1
+#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2
+#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3
+#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4
+#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5
+
+int PTR4 q4_var RBR4 = 0;
Index: testsuite/gcc.c-torture/compile/limits-fnargs.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-fnargs.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-fnargs.c (revision 0)
@@ -0,0 +1,20 @@
+#define PAR1 int, int, int, int, int, int, int, int, int, int
+#define PAR2 PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1
+#define PAR3 PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2
+#define PAR4 PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3
+#define PAR5 PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4
+#define PAR6 PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5
+
+extern void func (PAR4);
+
+#define ARG1 0,1,2,3,4,5,6,7,8,9
+#define ARG2 ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1
+#define ARG3 ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2
+#define ARG4 ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3
+#define ARG5 ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4
+#define ARG5HALF ARG5, ARG5, ARG5, ARG5, ARG5
+
+void caller(void)
+{
+ func (ARG4);
+}
Index: testsuite/gcc.c-torture/compile/limits-exprparen.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-exprparen.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-exprparen.c (revision 0)
@@ -0,0 +1,15 @@
+#define LBR1 ( ( ( ( ( ( ( ( ( (
+#define LBR2 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1
+#define LBR3 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2
+#define LBR4 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3
+#define LBR5 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4
+#define LBR6 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5
+
+#define RBR1 ) ) ) ) ) ) ) ) ) )
+#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1
+#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2
+#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3
+#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4
+#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5
+
+int q5_var = LBR4 0 RBR4;
Index: testsuite/gcc.c-torture/compile/limits-caselabels.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-caselabels.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-caselabels.c (revision 0)
@@ -0,0 +1,21 @@
+#define LIM1(x) x##0: x##1: x##2: x##3: x##4: x##5: x##6: x##7: x##8: x##9:
+#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \
+ LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9)
+#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \
+ LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9)
+#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \
+ LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9)
+#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \
+ LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9)
+#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \
+ LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9)
+#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \
+ LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9)
+
+void q19_func (int i)
+{
+ switch (i) {
+ LIM5 (case 1)
+ break;
+ }
+}
Index: testsuite/gcc.c-torture/compile/limits-pointer.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-pointer.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-pointer.c (revision 0)
@@ -0,0 +1,8 @@
+#define PTR1 * * * * * * * * * *
+#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1
+#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2
+#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3
+#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4
+#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5
+
+int PTR4 q3_var = 0;
Index: testsuite/gcc.c-torture/compile/limits-idinternal.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-idinternal.c (revision 0)
+++ testsuite/gcc.c-torture/compile/limits-idinternal.c (revision 0)
@@ -0,0 +1,29 @@
+#define LIM1 0123456789
+#define LIM2 LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1
+#define LIM3 LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2
+#define LIM4 LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3
+#define LIM5 LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4
+#define LIM6 LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5
+
+#define V(x) v##LIM6##x
+
+static int V(a);
+static int V(b);
============================================================
More information about the Gcc-patches
mailing list