-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
33 changed files
with
320 additions
and
31 deletions.
There are no files selected for viewing
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
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
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 @@ | ||
Error type 8 at Line 11: incompatiable return type | ||
Error type 8 at Line 13: incompatiable return type | ||
Error type 12 at Line 20: indexing by non-integer |
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,22 @@ | ||
int test_16() | ||
{ | ||
int c = 6; | ||
return c; | ||
} | ||
float aa() | ||
{ | ||
int a = 2; | ||
int f = 3; | ||
int h = 4; | ||
if (a < f && h > f) return f; | ||
else if ( a == f || h > a) return 5.0; | ||
else return a; | ||
} | ||
int test_2_s01() | ||
{ | ||
float aaa[5]; | ||
int b = 2; | ||
aaa[test_16()] = 2.0; | ||
aaa[aa()] = 2.0; | ||
return b; | ||
} |
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,4 @@ | ||
Error type 10 at line 4: indexing on non-array variable | ||
Error type 5 at line 4: unmatching type on both sides of assignment | ||
Error type 2 at Line 5: "func" is invoked without a definition | ||
Error type 5 at Line 5: unmatching type on both sides of assignment |
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,8 @@ | ||
int test_2_s02() | ||
{ | ||
int a[10]; | ||
int c = a[2][2]; | ||
a[2] = func(); | ||
} | ||
|
||
|
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,4 @@ | ||
Error type 1 at Line 3: "b" is used without a definition | ||
Error type 2 at Line 6: "function" is invoked without a definition | ||
Error type 3 at Line 10: variable "x" is redefined in the same scope | ||
Error type 4 at Line 20: "redefined_function" is redefined |
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,22 @@ | ||
int test_2_s03() { | ||
// Error Type 1: a variable is used without a definition | ||
int a = b + 123; | ||
|
||
// Error Type 2: a function is invoked without a definition | ||
int i = function(); | ||
|
||
// Error Type 3: a variable is redefined in the same scope | ||
int x = 0; | ||
int x = 1; | ||
|
||
return 0; | ||
} | ||
|
||
// Error Type 4: a function is redefined | ||
int redefined_function() { | ||
return 123; | ||
} | ||
|
||
int redefined_function() { | ||
return 456; | ||
} |
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,4 @@ | ||
Error type 5 at Line 17: unmatching types appear at both sides of the assignment operator | ||
Error type 9 at Line 20: invalid argument number for function "add" | ||
Error type 12 at Line 24: indexing by non-integer | ||
Error type 14 at Line 27: accessing an undefined structure member: add |
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,28 @@ | ||
struct St { | ||
int sss; | ||
float ttt; | ||
}; | ||
|
||
int add(int x, int y) | ||
{ | ||
return x + y; | ||
} | ||
|
||
int test_2_s04() { | ||
int a; | ||
int b[5]; | ||
struct St st; | ||
|
||
// Error Type 5 unmatching types appear at both sides of the assignment operator (=) | ||
st.sss = 12.34; | ||
|
||
// Error Type 9 a function’s arguments mismatch the declared parameters (either types or numbers, or both) | ||
add(st.sss, st.ttt); | ||
|
||
// Error Type 12 array indexing with a non-integer type expression | ||
st.ttt = 23.45; | ||
b[st.ttt]; | ||
|
||
// Error Type 14 accessing an undefined structure member | ||
st.add; | ||
} |
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,5 @@ | ||
Error type 7 at Line 9: unmatching operand | ||
Error type 5 at Line 9: unmatching type on both sides of assignment | ||
Error type 10 at line 12: indexing on non-array variable | ||
Error type 7 at Line 12: unmatching operand | ||
Error type 5 at Line 12: unmatching type on both sides of assignment |
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,14 @@ | ||
struct rabbit{ | ||
int a; | ||
char c; | ||
}; | ||
int test_2_s05(){ | ||
struct rabbit rrr; | ||
int ra = rrr.a; | ||
char rc = rrr.c; | ||
int error = ra && rc; | ||
error = error + 1; | ||
rrr = rrr + 1; | ||
error = ra[1]+1; | ||
return 0; | ||
} |
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,9 @@ | ||
Error type 9 at Line 9: invalid argument type at 1, except float, got int | ||
Error type 9 at Line 9: invalid argument type at 2, except char, got int | ||
Error type 9 at Line 10: invalid argument type at 0, except int, got float | ||
Error type 9 at Line 10: invalid argument type at 2, except char, got float | ||
Error type 9 at Line 11: invalid argument type at 0, except int, got char | ||
Error type 9 at Line 11: invalid argument type at 1, except float, got char | ||
Error type 9 at Line 12: invalid argument number, except 3, got 6 | ||
Error type 9 at Line 13: invalid argument number, except 3, got 6 | ||
Error type 9 at Line 14: invalid argument number, except 3, got 1 |
Oops, something went wrong.