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

String literals in assembly file #1

Open
kavon opened this issue Sep 6, 2018 · 1 comment
Open

String literals in assembly file #1

kavon opened this issue Sep 6, 2018 · 1 comment
Labels
bug mlrisc involves the MLRISC backend trunk related to the trunk branch

Comments

@kavon
Copy link
Member

kavon commented Sep 6, 2018

➤ ../bin/pmlc -sequential -mlrisc literal.pml 
literal.s:2131:9: error: invalid escape sequence (unrecognized character) in '.asciz' directive
        .asciz  "mlrisc\'s string literal bug"
                ^
error compiling generated assembly code

from the following program

val _ = print "mlrisc's string literal bug"

On Ubuntu 18.04, likely using clang to compile.

@kavon kavon added bug mlrisc involves the MLRISC backend labels Sep 6, 2018
kavon added a commit that referenced this issue Sep 6, 2018
@kavon kavon added the trunk related to the trunk branch label Sep 14, 2018
@JohnReppy
Copy link
Contributor

The source of this bug is probably the use of the String.toCString function from the SML Basis Library (I haven't actually checked the source). Note that \' is a valid C escape sequence, the toCString function is behaving correctly. The bug fix is to write a string literal processor that is customized to .asciz using the String.translate function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mlrisc involves the MLRISC backend trunk related to the trunk branch
Projects
None yet
Development

No branches or pull requests

2 participants