• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Issue in LLDB's Expression Parser
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue in LLDB's Expression Parser


  • Subject: Re: Issue in LLDB's Expression Parser
  • From: Andreas Grosam <email@hidden>
  • Date: Thu, 28 Jul 2011 11:35:17 +0200

On Jul 27, 2011, at 7:33 PM, Jim Ingham wrote:

> 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.

Hm, after verifying what I have stated, I have to admit I am wrong. Firstly, the result from clang is correct, which shall be "true" in this case. Secondly, I can't see any difference in lldb's result and the result from clang.
So, I probably did overlook a difference in my code and in the expression I entered into lldb. In the morning this appears crystal clear now, and I can't say what I have overlooked.
Sorry for that noise.

Andreas


> 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

References: 
 >Issue in LLDB's Expression Parser (From: Andreas Grosam <email@hidden>)
 >Re: Issue in LLDB's Expression Parser (From: Jim Ingham <email@hidden>)

  • Prev by Date: Re: Lion and gcc/g++ command not found
  • Next by Date: Re: Lion and gcc/g++ command not found
  • Previous by thread: Re: Issue in LLDB's Expression Parser
  • Next by thread: ld: symbol dyld_stub_binding_helper not found
  • Index(es):
    • Date
    • Thread