]> granicus.if.org Git - clang/commitdiff
Fix for PR2750; don't check for an 'e' in the trash after the token.
authorEli Friedman <eli.friedman@gmail.com>
Tue, 2 Sep 2008 05:29:22 +0000 (05:29 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Tue, 2 Sep 2008 05:29:22 +0000 (05:29 +0000)
Note that this isn't really a complete fix; I think there are other
potential overrun situations.  I don't really know what the best
systematic fix is, though.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55622 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/LiteralSupport.cpp
test/Lexer/numeric-literal-trash.c [new file with mode: 0644]

index f9fd1aac793d5fd126b7fc3f5a943120768d7df6..8c2f2aff47478cbec7fcd00d406523451140925c 100644 (file)
@@ -224,7 +224,7 @@ NumericLiteralParser(const char *begin, const char *end,
       saw_period = true;
       s = SkipDigits(s);
     } 
-    if (*s == 'e' || *s == 'E') { // exponent
+    if (s != ThisTokEnd && (*s == 'e' || *s == 'E')) { // exponent
       const char *Exponent = s;
       s++;
       saw_exponent = true;
diff --git a/test/Lexer/numeric-literal-trash.c b/test/Lexer/numeric-literal-trash.c
new file mode 100644 (file)
index 0000000..243825a
--- /dev/null
@@ -0,0 +1,13 @@
+/* RUN: clang -fsyntax-only -verify %s
+ */
+# define XRECORD(x, c_name) e##c (x, __LINE__)
+
+
+
+
+
+
+ void x() {
+
+XRECORD (XRECORD (1, 1), 1);
+    }