1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-22 21:29:50 +00:00

Added test demonstrating problem with NULL parameter. #706

This commit is contained in:
jespergravgaard 2021-08-14 23:24:13 +02:00
parent 39f79b668b
commit 93d19035ca
2 changed files with 22 additions and 0 deletions

View File

@ -99,6 +99,11 @@ public class TestProgramsFast extends TestPrograms {
compileAndCompare("null-constant.c");
}
//@Test
//public void testNullConstant1() throws IOException {
// compileAndCompare("null-constant-1.c");
//}
@Test
public void testBlockError2() throws IOException {
compileAndCompare("block-error-2.c");

View File

@ -0,0 +1,17 @@
// Test the NULL pointer
#include <stddef.h>
void main() {
char* SCREEN = (char*)0x0400;
SCREEN[1] = get(SCREEN);
SCREEN[0] = get(NULL);
}
char get(char* ptr) {
if(NULL==ptr)
return 0;
return *ptr;
}