diff --git a/regression/goto-analyzer/dependence-graph10/main.c b/regression/goto-analyzer/dependence-graph10/main.c new file mode 100644 index 000000000000..8cdfb5e41584 --- /dev/null +++ b/regression/goto-analyzer/dependence-graph10/main.c @@ -0,0 +1,15 @@ +int a; + +void main(void) +{ + int i = 0; + + if(i < 10) + { + a = 1; + } + else + { + a = 2; + } +} diff --git a/regression/goto-analyzer/dependence-graph10/test.desc b/regression/goto-analyzer/dependence-graph10/test.desc new file mode 100644 index 000000000000..865bc3508d15 --- /dev/null +++ b/regression/goto-analyzer/dependence-graph10/test.desc @@ -0,0 +1,12 @@ +CORE +main.c +--dependence-graph --show +activate-multi-line-match +EXIT=0 +SIGNAL=0 +// First assignment has a control dependency on the if +\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1 +// Second assignment has a control dependency on the if +\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 2 +-- +^warning: ignoring diff --git a/regression/goto-analyzer/dependence-graph11/main.c b/regression/goto-analyzer/dependence-graph11/main.c new file mode 100644 index 000000000000..c3ab582f6763 --- /dev/null +++ b/regression/goto-analyzer/dependence-graph11/main.c @@ -0,0 +1,15 @@ +int a; + +void func() +{ +} + +void main(void) +{ + func(); + + if(a < 10) + { + a = 1; + } +} diff --git a/regression/goto-analyzer/dependence-graph11/test.desc b/regression/goto-analyzer/dependence-graph11/test.desc new file mode 100644 index 000000000000..cf571745640a --- /dev/null +++ b/regression/goto-analyzer/dependence-graph11/test.desc @@ -0,0 +1,10 @@ +CORE +main.c +--dependence-graph --show +activate-multi-line-match +EXIT=0 +SIGNAL=0 +// Assignment has a control dependency on the if +\/\/ ([0-9]+).*\n.*IF.*a < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1 +-- +^warning: ignoring diff --git a/regression/goto-analyzer/dependence-graph12/main.c b/regression/goto-analyzer/dependence-graph12/main.c new file mode 100644 index 000000000000..0257cb1f1c53 --- /dev/null +++ b/regression/goto-analyzer/dependence-graph12/main.c @@ -0,0 +1,21 @@ +int a; + +void func() +{ +} + +void main(void) +{ + if(a < 7) + { + goto L; + } + + if(a < 10) + { + func(); + L: + a = 1; + a = 2; + } +} diff --git a/regression/goto-analyzer/dependence-graph12/test.desc b/regression/goto-analyzer/dependence-graph12/test.desc new file mode 100644 index 000000000000..1519d9774376 --- /dev/null +++ b/regression/goto-analyzer/dependence-graph12/test.desc @@ -0,0 +1,10 @@ +CORE +main.c +--dependence-graph --show +activate-multi-line-match +EXIT=0 +SIGNAL=0 +// Assignment has a control dependency on the if +\/\/ ([0-9]+).*\n.*IF.*a < 10.*THEN(.*\n)*Control dependencies: .*\1.*\n(.*\n){2,3}.*a = 2 +-- +^warning: ignoring diff --git a/regression/goto-analyzer/dependence-graph7/main.c b/regression/goto-analyzer/dependence-graph7/main.c new file mode 100644 index 000000000000..e0ab2d5b1a4c --- /dev/null +++ b/regression/goto-analyzer/dependence-graph7/main.c @@ -0,0 +1,10 @@ +int a; + +void main(void) +{ + int i = 0; + while(i < 10) + { + a = 1; + } +} diff --git a/regression/goto-analyzer/dependence-graph7/test.desc b/regression/goto-analyzer/dependence-graph7/test.desc new file mode 100644 index 000000000000..942baf1f73b2 --- /dev/null +++ b/regression/goto-analyzer/dependence-graph7/test.desc @@ -0,0 +1,14 @@ +CORE +main.c +--dependence-graph --show +activate-multi-line-match +EXIT=0 +SIGNAL=0 +// Assignment has a control dependency on the loop head +\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1 +// Backedge has a control dependency on the loop head +\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}\s*GOTO [0-9]+ +// Loop head has a control dependency on itself +Control dependencies: ([0-9]+)\n(.*\n)?\n.*\/\/ \1.*\n.*IF.*i < 10.*THEN +-- +^warning: ignoring diff --git a/regression/goto-analyzer/dependence-graph8/main.c b/regression/goto-analyzer/dependence-graph8/main.c new file mode 100644 index 000000000000..ca7bf52632fc --- /dev/null +++ b/regression/goto-analyzer/dependence-graph8/main.c @@ -0,0 +1,13 @@ +int a; + +void main(void) +{ + int i = 0; + while(i < 10) + { + if(i < 7) + { + a = 1; + } + } +} diff --git a/regression/goto-analyzer/dependence-graph8/test.desc b/regression/goto-analyzer/dependence-graph8/test.desc new file mode 100644 index 000000000000..0ba74c209f07 --- /dev/null +++ b/regression/goto-analyzer/dependence-graph8/test.desc @@ -0,0 +1,14 @@ +CORE +main.c +--dependence-graph --show +activate-multi-line-match +EXIT=0 +SIGNAL=0 +// Assignment has a control dependency on the if +\/\/ ([0-9]+).*\n.*IF.*i < 7.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1 +// If has a control dependency on the loop head +\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*i < 7 +-- +^warning: ignoring +// Assignment does not have a control dependency on the loop head +\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1 diff --git a/regression/goto-analyzer/dependence-graph9/main.c b/regression/goto-analyzer/dependence-graph9/main.c new file mode 100644 index 000000000000..d968c9f55e1c --- /dev/null +++ b/regression/goto-analyzer/dependence-graph9/main.c @@ -0,0 +1,16 @@ +int a; + +void main(void) +{ + int i = 0; + + if(i < 10) + { + if(i < 7) + { + a = 1; + } + + a = 2; + } +} diff --git a/regression/goto-analyzer/dependence-graph9/test.desc b/regression/goto-analyzer/dependence-graph9/test.desc new file mode 100644 index 000000000000..d2f9708f7968 --- /dev/null +++ b/regression/goto-analyzer/dependence-graph9/test.desc @@ -0,0 +1,12 @@ +CORE +main.c +--dependence-graph --show +activate-multi-line-match +EXIT=0 +SIGNAL=0 +// Second assignment has a control dependency on the outer if +\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 2 +-- +^warning: ignoring +// Second assignment does not have a control dependency on the inner if +\/\/ ([0-9]+).*\n.*IF.*i < 7.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 2