hth313 / Calypsi-tool-chains

Overview of the Calypsi tool chain and open source support packages
16 stars 0 forks source link

version 4.1: Can't have '$' character as last character in string literals #15

Closed rebeccabuckingham closed 1 year ago

rebeccabuckingham commented 1 year ago

Code that includes a dollar sign as the last character in a string literal will fail to compile with an error:

local symbol _StringLiteral_THREE$ cannot be made public

'THREE$' will be substituted with whatever the string literal happens to be. Here is a minimal example that can reproduce the issue:

#include <stdio.h>

const char *myVars[] = {
        "ZERO", "ONE", "TWO", "THREE$",
        "FOUR", "FIVE", "SIX", "SEVEN"
};

int main(void) {
        puts(myVars[4]);
        return 0;
}

compiled with cc65816 test.c

hth313 commented 1 year ago

The compiler will throw an internal error for any string that ends with a dollar sign. This is because it generates a label for the string, but the assembler gets confused and thinks it is a temporary (local) label. I have fixed this for the next release, planned for early May. Are you able to work around this until then, or do you need an urgent fix for this?

rebeccabuckingham commented 1 year ago

Hi Håkan-

Thanks for getting back to me so quickly-

I was able to work around the ‘$’ problem by dropping back to a previous version of the compiler, but then I ran into a different problem that I think you fixed in 4.1. (The error message was "internal error: Translator/Compiler/CG/PostIncForm.hs:(489,11)-(491,51): Non-exhaustive patterns in function treesUntil”, if that rings a bell.)

So, I’m kind of stuck where I’m at until the next build is ready.

That being said, it’s not like I’m using this for my job or anything, and I have a ton of code to read and understand, so waiting until early May is fine for me.

Thank you!

On Apr 17, 2023, at 10:34 PM, Håkan Thörngren @.***> wrote:

The compiler will throw an internal error for any string that ends with a dollar sign. This is because it generates a label for the string, but the assembler gets confused and thinks it is a temporary (local) label. I have fixed this for the next release, planned for early May. Are you able to work around this until then, or do you need an urgent fix for this?

— Reply to this email directly, view it on GitHub https://github.com/hth313/Calypsi-tool-chains/issues/15#issuecomment-1512350100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEF2PGOYQQWYANGZ6E7DVDXBX4TPANCNFSM6AAAAAAXBYHGLI. You are receiving this because you authored the thread.

hth313 commented 1 year ago

Release 4.2 is available with a fix for this.

rebeccabuckingham commented 1 year ago

Looks good, thank you!