aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Analysis/PrintfFormatString.cpp2
-rw-r--r--test/Sema/format-strings.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp
index 88671017a8..daaa072a70 100644
--- a/lib/Analysis/PrintfFormatString.cpp
+++ b/lib/Analysis/PrintfFormatString.cpp
@@ -200,7 +200,7 @@ static PrintfSpecifierResult ParsePrintfSpecifier(FormatStringHandler &H,
if (k == ConversionSpecifier::InvalidSpecifier) {
// Assume the conversion takes one argument.
- return !H.HandleInvalidPrintfConversionSpecifier(FS, Beg, I - Beg);
+ return !H.HandleInvalidPrintfConversionSpecifier(FS, Start, I - Start);
}
return PrintfSpecifierResult(Start, FS);
}
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index ba5fa8a3a6..c51dafdae5 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -174,6 +174,7 @@ void test10(int x, float f, int i, long long lli) {
printf("%.0Lf", (long double) 1.0); // no-warning
printf("%c\n", "x"); // expected-warning{{conversion specifies type 'int' but the argument has type 'char *'}}
printf("%c\n", 1.23); // expected-warning{{conversion specifies type 'int' but the argument has type 'double'}}
+ printf("Format %d, is %! %f", 1, 2, 4.4); // expected-warning{{invalid conversion specifier '!'}}
}
typedef unsigned char uint8_t;