Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment from dereferenced pointers can fail within loops on 6502 #25

Closed
agg23 opened this issue Dec 28, 2019 · 1 comment
Closed

Comments

@agg23
Copy link
Contributor

agg23 commented Dec 28, 2019

Full repro, designed for NES (-t nes_simple), but similarly fails on -t c64:

struct Sprite {
    byte y
}

array(Sprite) sprites [20]
Sprite test

void main() {
    byte i
    test = Sprite(1)
    pointer.Sprite test_pointer
    test_pointer = test.pointer

    sprites[0] = Sprite(5)
    pointer.Sprite current_sprite
    current_sprite = pointer.Sprite(sprites.pointer)
    for i,0,until,20 {
        current_sprite->y = test_pointer->y
    }
}

void irq() {

}

void nmi() {

}

Throws the error:

Exception in thread "main" scala.NotImplementedError: an implementation is missing
        at scala.Predef$.$qmark$qmark$qmark(Predef.scala:288)
        at millfork.compiler.mos.MosExpressionCompiler$.compileAssignment(MosExpressionCompiler.scala:2241)
        at millfork.compiler.mos.MosStatementCompiler$.compile(MosStatementCompiler.scala:186)
        at millfork.compiler.AbstractStatementCompiler.$anonfun$compile$1(AbstractStatementCompiler.scala:14)
        at scala.collection.immutable.List.map(List.scala:290)
        at millfork.compiler.AbstractStatementCompiler.compile(AbstractStatementCompiler.scala:14)
        at millfork.compiler.AbstractStatementCompiler.compileWhileStatement(AbstractStatementCompiler.scala:44)
        at millfork.compiler.mos.MosStatementCompiler$.compile(MosStatementCompiler.scala:298)
        at millfork.compiler.AbstractStatementCompiler.$anonfun$compile$1(AbstractStatementCompiler.scala:14)
        at scala.collection.immutable.List.map(List.scala:286)
        at millfork.compiler.AbstractStatementCompiler.compile(AbstractStatementCompiler.scala:14)
        at millfork.compiler.mos.MosCompiler$.compile(MosCompiler.scala:19)
        at millfork.output.AbstractAssembler.compileFunction(AbstractAssembler.scala:670)
        at millfork.output.AbstractAssembler.$anonfun$assemble$10(AbstractAssembler.scala:237)
        at millfork.output.AbstractAssembler.$anonfun$assemble$10$adapted(AbstractAssembler.scala:236)
        at scala.Option.foreach(Option.scala:407)
        at millfork.output.AbstractAssembler.$anonfun$assemble$9(AbstractAssembler.scala:236)
        at millfork.output.AbstractAssembler.$anonfun$assemble$9$adapted(AbstractAssembler.scala:235)
        at scala.collection.immutable.List.foreach(List.scala:392)
        at millfork.output.AbstractAssembler.assemble(AbstractAssembler.scala:235)
        at millfork.Main$.assembleForMos(Main.scala:262)
        at millfork.Main$.main(Main.scala:90)
        at millfork.Main.main(Main.scala)

This does successfully compile against Z80 targets.

@KarolS
Copy link
Owner

KarolS commented Dec 30, 2019

Thanks for your report.

This will be fixed in the next release.

@KarolS KarolS closed this as completed in 69c82d9 Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants