diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 93af30c83c3..dd63d6172e2 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -9130,8 +9130,13 @@ bool ARMAsmParser::parseDirectiveEabiAttr(SMLoc L) { if (Tag == ARMBuildAttrs::compatibility) { if (Parser.getTok().isNot(AsmToken::Comma)) IsStringValue = false; - else - Parser.Lex(); + if (Parser.getTok().isNot(AsmToken::Comma)) { + Error(Parser.getTok().getLoc(), "comma expected"); + Parser.eatToEndOfStatement(); + return false; + } else { + Parser.Lex(); + } } if (IsStringValue) { diff --git a/test/MC/ARM/directive-eabi_attribute-diagnostics.s b/test/MC/ARM/directive-eabi_attribute-diagnostics.s index d1ae352b25f..2b0375e5761 100644 --- a/test/MC/ARM/directive-eabi_attribute-diagnostics.s +++ b/test/MC/ARM/directive-eabi_attribute-diagnostics.s @@ -29,6 +29,11 @@ @ CHECK: .eabi_attribute 0 @ CHECK: ^ + .eabi_attribute Tag_compatibility, 1 +@ CHECK: error: comma expected +@ CHECK: .eabi_attribute Tag_compatibility, 1 +@ CHECK: ^ + .eabi_attribute Tag_MPextension_use_old, 0 @ CHECK: error: attribute name not recognised: Tag_MPextension_use_old @ CHECK: .eabi_attribute Tag_MPextension_use_old, 0 diff --git a/test/MC/ARM/directive-eabi_attribute-overwrite.s b/test/MC/ARM/directive-eabi_attribute-overwrite.s index 69342b2cd81..e2c50997275 100644 --- a/test/MC/ARM/directive-eabi_attribute-overwrite.s +++ b/test/MC/ARM/directive-eabi_attribute-overwrite.s @@ -3,8 +3,6 @@ .syntax unified .thumb -@ FIXME: The next directive is not correct, Tag_compatibility isn't getting parsed correctly. - .eabi_attribute Tag_compatibility, 1 .eabi_attribute Tag_compatibility, 1, "aeabi" @ CHECK-ATTR: FileAttributes { diff --git a/test/MC/ARM/directive-eabi_attribute.s b/test/MC/ARM/directive-eabi_attribute.s index ac7358f39d7..74a51ab7279 100644 --- a/test/MC/ARM/directive-eabi_attribute.s +++ b/test/MC/ARM/directive-eabi_attribute.s @@ -173,8 +173,6 @@ @ CHECK-OBJ-NEXT: Value: 1 @ CHECK-OBJ-NEXT: TagName: ABI_FP_optimization_goals @ CHECK-OBJ-NEXT: Description: Speed - .eabi_attribute Tag_compatibility, 1 -@ CHECK: .eabi_attribute 32, 1 .eabi_attribute Tag_compatibility, 1, "aeabi" @ CHECK: .eabi_attribute 32, 1, "aeabi" @ CHECK-OBJ: Tag: 32