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

Errors in inline assembly don't stop compilation #4293

Closed
zyedidia opened this issue Dec 31, 2022 · 0 comments · May be fixed by #4302
Closed

Errors in inline assembly don't stop compilation #4293

zyedidia opened this issue Dec 31, 2022 · 0 comments · May be fixed by #4302

Comments

@zyedidia
Copy link
Contributor

Here is a program with some invalid inline assembly:

void main() {
    asm {
        "a";
    }
}

I compile with

$ ldc2 asm.d
asm.d(3):1:2: error: invalid instruction mnemonic 'a'
        a
        ^

It correctly shows an error, but also produces an executable (it seems like it just removed the inline asm statement and compiled everything else), and the return code from compiling is 0 (success). This could go unnoticed if checking for success is automated based on the shell command's return code. I think the problem is that this error occurs during codegen, and there is no code to handle a codegen error in driver/toobj.cpp (that I could find).

kinke added a commit to kinke/ldc that referenced this issue Feb 26, 2023
kinke added a commit to kinke/ldc that referenced this issue Feb 26, 2023
kinke added a commit to kinke/ldc that referenced this issue Feb 26, 2023
@kinke kinke closed this as completed in 7d3f5ba Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant