[cfe-dev] clang unable to build example C file

Chris Lattner clattner at apple.com
Thu Oct 11 14:41:39 PDT 2007


On Oct 11, 2007, at 1:20 PM, Török Edvin wrote:

> On 10/11/07, Chris Lattner <clattner at apple.com> wrote:
>>
>> Ok, very strange.  As Anton mentioned, please try with a debug
>> build.  This should give us line numbers which will make it easier to
>> identify the problem.
>
> Hi,
>
> Thank for the quick patch yesterday.
>
> See the results of running valgrind on a debug build of llvm r42868 at
> the end of this mail.
>
> ==25125== Conditional jump or move depends on uninitialised value(s)
> ==25125==    at 0x687876: clang::IdentifierInfo::getPPKeywordID()
> const (IdentifierTable.cpp:160)
>
> I added a printf("%lu\n",Len); before  "if (Len < 2) return
> tok::pp_not_keyword;"
>
> $ clang t.c 2>/dev/null| sort |uniq -c
>      85 0
>
> I get all zeros, which is not what I expected.
> Where is Len set? I could try to add some printfs there...

It is somewhat convoluted, but len is set when the identifier is  
lexed.  The codepath is through the  
StringMap<IdentifierInfo>::GetOrCreateValue method, which calls  
StringMapEntry<IdentifierInfo>::Create, which sets the size on line  
155 of llvm/include/llvm/ADT/StringMap.h.

I don't see how there could be a problem here, everything looks  
reasonable.

-Chris



More information about the cfe-dev mailing list