Files
codeql/csharp/ql/test/library-tests/controlflow/splits/SplittingStressTest.cs
Tom Hvitved 4774bc969a C#: Apply static CFG splitting limit
The predicate `maxSplits()` was previously applied dynamically to ensure that
any control flow node would keep track of at most `maxSplits()` number of splits.
However, there was no guarantee that two different copies of the same AST element
wouldn't contain different splits, so in general the number of copies for a given
AST element `e` could be on the order `$\binom{n}{k}c^k$`, where `n` is the total
number of splits that apply to `e`, `k = maxSplits()`, and `c` is a constant.

With this change, the relevant splits for `e` are instead computed statically,
meaning that the order is instead `$c^k$`.
2019-08-06 11:38:03 +02:00

322 lines
6.0 KiB
C#

class SplittingStressTest
{
void M1(bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7, bool b8, bool b9, bool b10, bool b11, bool b12, bool b13, bool b14, bool b15, bool b16, bool b17, bool b18, bool b19, bool b20, bool b21, bool b22, bool b23, bool b24, bool b25, bool b26, bool b27, bool b28, bool b29, bool b30, bool b31, bool b32, bool b33, bool b34, bool b35, bool b36, bool b37, bool b38, bool b39, bool b40)
{
if (b1)
;
if (b2)
;
if (b3)
;
if (b4)
;
if (b5)
;
if (b6)
;
if (b7)
;
if (b8)
;
if (b9)
;
if (b10)
;
if (b11)
;
if (b12)
;
if (b13)
;
if (b14)
;
if (b15)
;
if (b16)
;
if (b17)
;
if (b18)
;
if (b19)
;
if (b20)
;
if (b21)
;
if (b22)
;
if (b23)
;
if (b24)
;
if (b25)
;
if (b26)
;
if (b27)
;
if (b28)
;
if (b29)
;
if (b30)
;
if (b31)
;
if (b32)
;
if (b33)
;
if (b34)
;
if (b35)
;
if (b36)
;
if (b37)
;
if (b38)
;
if (b39)
;
if (b40)
;
; // 2^40 splits
if (b1)
;
if (b2)
;
if (b3)
;
if (b4)
;
if (b5)
;
if (b6)
;
if (b7)
;
if (b8)
;
if (b9)
;
if (b10)
;
if (b11)
;
if (b12)
;
if (b13)
;
if (b14)
;
if (b15)
;
if (b16)
;
if (b17)
;
if (b18)
;
if (b19)
;
if (b20)
;
if (b21)
;
if (b22)
;
if (b23)
;
if (b24)
;
if (b25)
;
if (b26)
;
if (b27)
;
if (b28)
;
if (b29)
;
if (b30)
;
if (b31)
;
if (b32)
;
if (b33)
;
if (b34)
;
if (b35)
;
if (b36)
;
if (b37)
;
if (b38)
;
if (b39)
;
if (b40)
;
;
}
void M2(int i, bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7, bool b8, bool b9, bool b10, bool b11, bool b12, bool b13, bool b14, bool b15, bool b16, bool b17, bool b18, bool b19, bool b20, bool b21, bool b22, bool b23, bool b24, bool b25, bool b26, bool b27, bool b28, bool b29)
{
while (i-- > 0)
{
if (i == 1)
{
if (b1)
;
}
if (i == 2)
{
if (b2)
;
}
if (i == 3)
{
if (b3)
;
}
if (i == 4)
{
if (b4)
;
}
if (i == 5)
{
if (b5)
;
}
if (i == 6)
{
if (b6)
;
}
if (i == 7)
{
if (b7)
;
}
if (i == 8)
{
if (b8)
;
}
if (i == 9)
{
if (b9)
;
}
if (i == 10)
{
if (b10)
;
}
if (i == 11)
{
if (b11)
;
}
if (i == 12)
{
if (b12)
;
}
if (i == 13)
{
if (b13)
;
}
if (i == 14)
{
if (b14)
;
}
if (i == 15)
{
if (b15)
;
}
if (i == 16)
{
if (b16)
;
}
if (i == 17)
{
if (b17)
;
}
if (i == 18)
{
if (b18)
;
}
if (i == 19)
{
if (b19)
;
}
if (i == 20)
{
if (b20)
;
}
if (i == 21)
{
if (b21)
;
}
if (i == 22)
{
if (b22)
;
}
if (i == 23)
{
if (b23)
;
}
if (i == 24)
{
if (b24)
;
}
if (i == 25)
{
if (b25)
;
}
if (i == 26)
{
if (b26)
;
}
if (i == 27)
{
if (b27)
;
}
if (i == 28)
{
if (b28)
;
}
if (i == 29)
{
if (b29)
;
}
}
}
}