Skip to content

Commit

Permalink
Add test on code generation for multiple declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
Lai-YT authored and leewei05 committed Jun 13, 2024
1 parent 9ca9d46 commit 6ef6a7b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions test/codegen/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ int main() {
a[3] = 2 + a[2];
__builtin_print(a[3]);

int b = 2;
int c = 0;
int d[4] = {1, b, c = 3, 4};
int b = 2, c = 0, d[4] = {1, b, c = 3, 4};
__builtin_print(d[0]);
__builtin_print(d[1]);
__builtin_print(d[2]);
Expand Down
2 changes: 2 additions & 0 deletions test/codegen/decl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ int main() {
int i;
int j = 2;
__builtin_print(j);
int a = 3, b;
__builtin_print(a);
return 0;
}
1 change: 1 addition & 0 deletions test/codegen/decl.exp
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
2
3
2 changes: 1 addition & 1 deletion test/codegen/for_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int main() {
// Nested for loop
//
int k = 0;
for (int i = 0; i < 5; i = i + 1) {
for (int i = 0, e = 5; i < e; i = i + 1) {
for (int j = 0; j < 5; j = j + 1) {
k = k + 1;
}
Expand Down
3 changes: 1 addition & 2 deletions test/codegen/pointer.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
int main() {
int a = 10;
int* b = &a;
int* c;
int *b = &a, *c;
__builtin_print(a);

*b = 5;
Expand Down

0 comments on commit 6ef6a7b

Please sign in to comment.