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

jahanian fjahanian at apple.com
Fri Sep 27 08:34:01 PDT 2013


Yay. This has fixed our VS buildbot failure. Thanks.

- Fariborz

On Sep 26, 2013, at 9:42 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:

> 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
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list