mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-14 23:04:57 +00:00
Added test provoking a register clobber error.
This commit is contained in:
parent
63f6620246
commit
b466f2f5cc
@ -41,7 +41,7 @@ public class Pass4AssertNoCpuClobber extends Pass2Base {
|
||||
*/
|
||||
public void check() {
|
||||
if(hasClobberProblem(true)) {
|
||||
throw new RuntimeException("CLOBBER ERROR! See log for more info.");
|
||||
throw new CompileError("CLOBBER ERROR! See log for more info.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,6 +507,11 @@ public class TestPrograms {
|
||||
assertError("illegal-alignment", "Cannot align variable");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegisterClobber() throws IOException, URISyntaxException {
|
||||
assertError("register-clobber", "CLOBBER ERROR");
|
||||
}
|
||||
|
||||
private void assertError(String kcFile, String expectError) throws IOException, URISyntaxException {
|
||||
try {
|
||||
compileAndCompare(kcFile);
|
||||
|
@ -0,0 +1,8 @@
|
||||
void main() {
|
||||
byte* SCREEN = $0400;
|
||||
for( register(X) byte x: 0..100 ) {
|
||||
for( register(X) byte y: 0..100 ) {
|
||||
SCREEN[x] = y;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user