Index: lib/MC/MCParser/AsmParser.cpp =================================================================== --- lib/MC/MCParser/AsmParser.cpp +++ lib/MC/MCParser/AsmParser.cpp @@ -1842,7 +1842,7 @@ // Otherwise, we have a normal instruction or directive. // Directives start with "." - if (IDVal[0] == '.' && IDVal != ".") { + if (IDVal.startswith(".") && IDVal != ".") { // There are several entities interested in parsing directives: // // 1. The target-specific assembly parser. Some directives are target Index: test/Assembler/empty-string.s =================================================================== --- /dev/null +++ test/Assembler/empty-string.s @@ -0,0 +1,3 @@ +// REQUIRES: riscv-registered-target +// RUN: not llvm-mc -triple riscv32-unknown-linux-gnu < %s 2>&1 | FileCheck %s +"" # CHECK: error: unrecognized instruction mnemonic