[cfe-dev] Define new pragma in Clang
Alexandra
xinfinity_a at yahoo.com
Fri Jan 29 01:26:50 PST 2010
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 {
...
// 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
More information about the cfe-dev
mailing list