Skip to content

Errors in inline assembly don't stop compilation #4293

@zyedidia

Description

@zyedidia
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).

Activity

added 3 commits that reference this issue on Feb 26, 2023
671cf70
c67c6e1
bad2ca9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @zyedidia

      Issue actions

        Errors in inline assembly don't stop compilation · Issue #4293 · ldc-developers/ldc