r191485 - NumericLiteralParser::ParseNumberStartingWithZero(): Try to appease MSC16's miscompilation.

NAKAMURA Takumi geek4civic at gmail.com
Thu Sep 26 21:42:28 PDT 2013


Author: chapuni
Date: Thu Sep 26 23:42:28 2013
New Revision: 191485

URL: http://llvm.org/viewvc/llvm-project?rev=191485&view=rev
Log:
NumericLiteralParser::ParseNumberStartingWithZero(): Try to appease MSC16's miscompilation.

Investigating yet. It seems msc16 miscompiles s[1] to be folded.

Modified:
    cfe/trunk/lib/Lex/LiteralSupport.cpp

Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=191485&r1=191484&r2=191485&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Thu Sep 26 23:42:28 2013
@@ -706,8 +706,11 @@ void NumericLiteralParser::ParseNumberSt
   assert(s[0] == '0' && "Invalid method call");
   s++;
 
+  int c1 = s[0];
+  int c2 = s[1];
+
   // Handle a hex number like 0x1234.
-  if ((*s == 'x' || *s == 'X') && (isHexDigit(s[1]) || s[1] == '.')) {
+  if ((c1 == 'x' || c1 == 'X') && (isHexDigit(c2) || c2 == '.')) {
     s++;
     radix = 16;
     DigitsBegin = s;
@@ -757,7 +760,7 @@ void NumericLiteralParser::ParseNumberSt
   }
 
   // Handle simple binary numbers 0b01010
-  if ((*s == 'b' || *s == 'B') && (s[1] == '0' || s[1] == '1')) {
+  if ((c1 == 'b' || c1 == 'B') && (c2 == '0' || c2 == '1')) {
     // 0b101010 is a C++1y / GCC extension.
     PP.Diag(TokLoc,
             PP.getLangOpts().CPlusPlus1y





More information about the cfe-commits mailing list