[cfe-dev] Define new pragma in Clang

Chris Lattner clattner at apple.com
Mon Feb 1 17:52:56 PST 2010


On Jan 29, 2010, at 1:26 AM, Alexandra wrote:

> Daniel Dunbar <daniel at ...> writes:
>
>>
>> Hi Alexandra,
>>
>> Its hard for me to know the problem without seeing the patch/crash.  
>> It
>> looks like clang is crashing when it tries to index into a  
>> SmallVector
>> out-of-bounds. I suggest you run clang in a debugger and see what  
>> code
>> is doing this, which will probably give a clue as to the problem.
>>
>> - Daniel
>
>
> It seems that the problem is in the file Metadata.cpp in
> void MetadataContextImpl::
> getMDs(const Instruction *Inst, SmallVectorImpl<MDPairTy> &MDs)  
> const {

The function "getMDs" doesn't exist on mainline.  If you're using LLVM  
2.6 with metadata, I strongly recommend you upgrade to mainline svn.

-Chris

>
> ...
>
> // MD kinds are numbered from 1.
> MDs[MI->first - 1] = std::make_pair(MI->first, MI->second);
>
> }
>
> Since the instruction has metadata attached, but the value of the MD  
> kind is 2.
> The metadata with MD kind equal to 1 was attached to a previous  
> instruction.
> Taking care of the index of  MDs[MI->first - 1] solves the problem.
>
> I used an int idx = 0 and  MDs[idx++] = std::make_pair(MI->first, MI- 
> >second);
>
> I hope this is correct.
>
> Alexandra
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list