Re: Issue in LLDB's Expression Parser
Re: Issue in LLDB's Expression Parser
- Subject: Re: Issue in LLDB's Expression Parser
- From: Jim Ingham <email@hidden>
- Date: Wed, 27 Jul 2011 10:33:29 -0700
lldb uses clang as its expression parser. There can be some subtle differences because at present we always run Clang in ObjC++ mode.
But in this case, I'm not sure what you are seeing, but I get:
> cat foo.cpp
#include <stdio.h>
#include <stdint.h>
int main ()
{
uint8_t c = 0;
bool value = (c - 0xC2) < 0x32;
if (value)
printf ("True.\n");
else
printf ("False.\n");
return 0;
}
> clang++ -g -O0 -o foo foo.cpp
> ./foo
True.
I'm not sure what you are seeing that is different.
Jim
On Jul 27, 2011, at 4:16 AM, Andreas Grosam wrote:
> Hi All,
>
>
> I figured an issue in the expression parser of LLDB.
>
> Firstly, I'm not sure if LLDB uses its own parser or if it's based somehow on LLVM. Anyway, here is the problem:
>
> LLDB prints the following result for the given expression:
> (lldb) print ((uint8_t)(0) - 0xC2) < 0x32
> (_Bool) $2 = true
>
>
> If my understandings of the C99 integer promotion, value preserving and sign preserving rules are correct, the result should be false however.
> The rationale and the rules for the above expression do appear complex, however LLVM and GCC both agree on me ;)
>
>
> Here is code that corresponds to the expression above:
>
> uint8_t c = 0;
> bool result = (c - 0xC2) < 0x32;
>
> LLVM and GCC will evaluate this to false.
>
>
>
> Regards
> Andreas
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden