aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/Expr.cpp2
-rw-r--r--test/Sema/asm.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index fdcb77f324..1d0319f601 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -593,7 +593,7 @@ getLocationOfByte(unsigned ByteNo, const SourceManager &SM,
// If the byte is in this token, return the location of the byte.
if (ByteNo < TokNumBytes ||
- (ByteNo == TokNumBytes && TokNo == getNumConcatenated())) {
+ (ByteNo == TokNumBytes && TokNo == getNumConcatenated() - 1)) {
unsigned Offset = SLP.getOffsetOfStringByte(TheTok, ByteNo);
// Now that we know the offset of the token in the spelling, use the
diff --git a/test/Sema/asm.c b/test/Sema/asm.c
index a3313cad2b..f1c24c8fb6 100644
--- a/test/Sema/asm.c
+++ b/test/Sema/asm.c
@@ -117,3 +117,9 @@ void test11(void) {
void test12(void) {
register int cc __asm ("cc"); // expected-error{{unknown register name 'cc' in asm}}
}
+
+// PR10223
+void test13(void) {
+ void *esp;
+ __asm__ volatile ("mov %%esp, %o" : "=r"(esp) : : ); // expected-error {{invalid % escape in inline assembly string}}
+}