-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b43670b
commit 8fddc94
Showing
16 changed files
with
522 additions
and
0 deletions.
There are no files selected for viewing
165 changes: 165 additions & 0 deletions
165
regression-tests/pure2-nested-ifs-conditions-error.cpp2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
main: (args) = | ||
{ | ||
a := 1; | ||
b := 2; | ||
c := 3; | ||
d := 4; | ||
|
||
{ | ||
p : *int; | ||
|
||
// no initialization in selection_node | ||
if args.argc > 20 { | ||
c = 20; | ||
} else if args.argc > 10 { | ||
c = 10; | ||
} else { | ||
if args.argc % 2 { | ||
b = 2; | ||
} else { | ||
b = 1; | ||
} | ||
} | ||
|
||
// initialization in first if condition | ||
if p = b& { | ||
p = a&; | ||
} else if args.argc == 3 { | ||
p = b&; | ||
if args.argc == 2 { | ||
p = c&; | ||
} else { | ||
if b > 0 { | ||
p = a&; | ||
} | ||
else { | ||
p = d&; | ||
} | ||
} | ||
} else { | ||
p = c&; | ||
} | ||
|
||
std::cout << p* << std::endl; | ||
} | ||
|
||
{ | ||
p : *int; | ||
|
||
// initialization in: | ||
// - first if branch | ||
// - second if condition | ||
if args.argc == 3 { | ||
p = a&; | ||
} else if p = b& { | ||
p = b&; | ||
if args.argc == 2 { | ||
p = c&; | ||
} else { | ||
if b > 0 { | ||
p = a&; | ||
} | ||
else { | ||
p = d&; | ||
} | ||
} | ||
} else { | ||
p = c&; | ||
} | ||
|
||
std::cout << p* << std::endl; | ||
} | ||
|
||
{ | ||
p : *int; | ||
|
||
// initialization in: | ||
// - first if branch | ||
// - second if branch in nested if condition (first if) | ||
// - else branch | ||
if args.argc == 3 { | ||
p = a&; | ||
} else if args.argc == 2 { | ||
if p = b& { | ||
p = c&; | ||
} else { | ||
if b > 0 { | ||
p = a&; | ||
} | ||
else { | ||
p = d&; | ||
} | ||
} | ||
} else { | ||
p = c&; | ||
} | ||
|
||
std::cout << p* << std::endl; | ||
} | ||
|
||
{ | ||
p : *int; | ||
|
||
// initialization in: | ||
// - first if branch | ||
// - second if branch in nested if: | ||
// - first branch | ||
// - second branch in nested if condition (first if) | ||
// - else branch | ||
if args.argc == 3 { | ||
p = a&; | ||
} else if args.argc == 2 { | ||
if b > 0 { | ||
p = c&; | ||
} else { | ||
if p = b& { | ||
p = a&; | ||
} | ||
else { | ||
p = d&; | ||
} | ||
p* = 42; | ||
} | ||
p* = 24; | ||
} else { | ||
p = c&; | ||
} | ||
|
||
std::cout << p* << std::endl; | ||
} | ||
|
||
{ | ||
p : *int; | ||
|
||
// initialization in: | ||
// - first if branch | ||
// - second if branch in nested if: | ||
// - first branch | ||
// - second branch in nested if: | ||
// - first if branch | ||
// - second if condition | ||
// - else branch | ||
if args.argc == 3 { | ||
p = a&; | ||
} else if args.argc == 2 { | ||
if b > 0 { | ||
p = c&; | ||
} else { | ||
if b > 2 { | ||
p = a&; | ||
} | ||
else if p = b& { | ||
d = p*; | ||
} | ||
else { | ||
p = d&; | ||
} | ||
} | ||
} else { | ||
p = c&; | ||
} | ||
|
||
std::cout << p* << std::endl; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
main: (args) = { | ||
p : *int; | ||
|
||
a := 1; | ||
b := 2; | ||
c := 3; | ||
d := 4; | ||
|
||
if args.argc == 3 { | ||
p = a&; | ||
} else if b > 2 { | ||
if args.argc == 2 { | ||
p = c&; | ||
} else { | ||
if b > 0 { | ||
p = a&; | ||
} | ||
else { | ||
p = d&; | ||
} | ||
} | ||
} else { | ||
// p = c&; | ||
} | ||
|
||
std::cout << p* << std::endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
main: (args) = | ||
{ | ||
a := 1; | ||
b := 2; | ||
c := 3; | ||
d := 4; | ||
|
||
{ | ||
p : *int; | ||
|
||
// no initialization in selection_node | ||
if args.argc > 20 { | ||
c = 20; | ||
} else if args.argc > 10 { | ||
c = 10; | ||
} else { | ||
if args.argc % 2 { | ||
b = 2; | ||
} else { | ||
b = 1; | ||
} | ||
} | ||
|
||
// initialization in: | ||
// - first if branch | ||
// - second if branch in nested if: | ||
// - first branch | ||
// - second branch in nested if: | ||
// - first if branch | ||
// - else branch | ||
// - else branch | ||
if args.argc == 3 { | ||
p = a&; | ||
} else if args.argc == 2 { | ||
if b > 0 { | ||
p = c&; | ||
} else { | ||
if b > 2 { | ||
p = a&; | ||
} | ||
else { | ||
p = d&; | ||
} | ||
} | ||
} else { | ||
p = c&; | ||
} | ||
|
||
std::cout << p* << std::endl; | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
regression-tests/test-results/apple-clang-14/pure2-nested-ifs.cpp.execution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3 |
Empty file.
1 change: 1 addition & 0 deletions
1
regression-tests/test-results/clang-12/pure2-nested-ifs.cpp.execution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3 |
Empty file.
1 change: 1 addition & 0 deletions
1
regression-tests/test-results/gcc-10/pure2-nested-ifs.cpp.execution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3 |
Empty file.
1 change: 1 addition & 0 deletions
1
regression-tests/test-results/msvc-2022/pure2-nested-ifs.cpp.execution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3 |
Empty file.
Oops, something went wrong.