-
Notifications
You must be signed in to change notification settings - Fork 425
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
backwards indirect goto does not compile #1209
Comments
Now this is some crazyness. I'd file it under "barely legal" :=) |
Is this the expected output (compiled with a #897 solution)? ; ---------------------------------------------------------------
; int __near__ f (void)
; ---------------------------------------------------------------
.segment "CODE"
.proc _f: near
.segment "CODE"
;
; L: if (x[0] != 0) return 0;
;
L0002: lda M0001
ldx M0001+1
cpx #$00
bne L0006
cmp #$00
L0006: jsr boolne
jeq L0003
ldx #$00
lda #$00
jmp L0001
;
; x[0] = &&L;
;
L0003: lda #<(L0002)
ldx #>(L0002)
sta M0001
stx M0001+1
;
; goto *x[0];
;
ldy #$00
lda M0001,y
ldx M0001+1,y
jmp callax
;
; }
;
L0001: rts
.segment "BSS"
M0001:
.res 2,$00
.endproc |
Yes, that looks right. |
Change err/ tests to use cl65 and .prg instead of cc65 and .s since this test only fails at the link stage.
Change err/ tests to use cl65 and .prg instead of cc65 and .s since this test only fails at the link stage.
Change err/ tests to use cl65 and .prg instead of cc65 and .s since this test only fails at the link stage.
@clbr it looks like you implemented computed gotos. |
Dynamic computed gotos are not supported, so from that sense this is not a bug. |
Based on the generated code, there's no reason it shouldn't work. It's just the code preventing the label deletion that doesn't work. If the intent really were to not support this, there should be an error like "dynamic computed goto not supported", rather than an obscure linker error. |
Here's version with the same failure and no dynamic computed goto.
|
That's what made me classify this issue as bug. |
There is no such error message because it didn't occur to me at the time someone would try something that crazy... |
The new sample still confuses me on why you would do that in the first place, but ok, it's a valid bug. |
I don't actually want to do any of the things in this bug, but there should be no reason not to allow them. I was trying to look at the computed goto label handling code to see how things should work because there are (unsurprisingly) similar issues for #1049 trying to use jump tables for switch. I looked at the code, said, "wait, how does this work?" and found that it doesn't. #1211 is equivalent to something that needs to be handled for #1049, so I'm more interested in a fix for that one. |
This test case don't use dynamic labels. cc65#1209 (comment)
These test cases don't use dynamic labels. cc65#1209 (comment) Also update the original test case for consistency: * Change failure message to just "FAIL", as there is only one failure * Outdent label definitions * Clarify description
misc/ is the correct place for tests that should compile but do not. Revert err/Makefile changes from cc65#1210.
misc/ is the correct place for tests that should compile but do not. Revert err/Makefile changes from #1210.
These test cases don't use dynamic labels. cc65#1209 (comment) Also update the original test case for consistency: * Change failure message to just "FAIL", as there is only one failure * Outdent label definitions * Clarify description
These test cases don't use dynamic labels. #1209 (comment) Also update the original test case for consistency: * Change failure message to just "FAIL", as there is only one failure * Outdent label definitions * Clarify description
My fix for this depends on something tha depends on something that depends on something that depends on something... that is seemingly irrelevent to this one.... The "gap" between the current HEAD of the master branch and the fix is |
If you plan to close the gap in the foreseeable future, I personally don't see why you should invest into changing the order of your commits just because of the existence of this issue. |
I've been closing the gap. There are still (3 + 1) + 21 = 25 commits to go before the fix branch could be merged and tested. That would be the 2 current PRs plus about 6 new ones. |
We "nosy bees" appreciate the progress report. |
+1 |
yes! I am totally overwhelmed by how it is moving forward atm. Don't stop :) |
Results in:
This works with gcc.
It looks like something is wrong with the way
GotoStatement
is trying to prevent labels from getting deleted.I'll send a PR with a test case soon.
The text was updated successfully, but these errors were encountered: