1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-23 08:32:39 +00:00

Added test demonstrating problem with passing derefed struct pointer to call. #225

This commit is contained in:
Jesper Gravgaard 2019-07-16 22:45:13 +02:00
parent cb5dc6550e
commit 889cc1219f
2 changed files with 27 additions and 0 deletions

View File

@ -35,6 +35,13 @@ public class TestPrograms {
public TestPrograms() {
}
/*
@Test
public void testProblemStructPointerParam() throws IOException, URISyntaxException {
compileAndCompare("problem-struct-pointer-param");
}
*/
/*
@Test
public void testProblemArrayStructParam() throws IOException, URISyntaxException {

View File

@ -0,0 +1,20 @@
// Demonstrates problem with passing struct pointer deref as parameter to call
const char* SCREEN = 0x0400;
char idx = 0;
struct Point {
char x;
char y;
};
void main() {
struct Point point = { 1, 2 };
struct Point* ptr = &point;
print(*ptr);
}
void print(struct Point p) {
SCREEN[idx++] = p.x;
SCREEN[idx++] = p.y;
}