[cfe-commits] clang patch for bug 14021

Robert Muth robertm at google.com
Tue Oct 16 08:12:39 PDT 2012


On Mon, Oct 15, 2012 at 10:57 PM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> On 15 October 2012 19:02, Robert Muth <robertm at google.com> wrote:
>> No small test, sadly.
>> I managed to cut a 10MB reproducer down to 2MB over 2h
>> but no further.
>
> The testcase in the bug report is already a lot smaller than that.
> Running delta a bit more reduced it to the attached file, which I am
> sure can be reduced a bit more.

The reproducer in the bug has a lot of problems, e.g.
it is only a fragment - not valid C++ code.
It is also not a very stable reproducers meaning changing the clang
command line slightly
will change clang's memory allocation enough that the bug does not get triggered
anymore and instead you get a compiler failure because the code is
only a fragment.

This stability issue would likely effect any test for this problem,
even valgrind based ones.

Having thought  about this a little more think the best way to
approach the problem of invalidated iterators
is not by adding tests each time we find one but by addressing it at a
higher level, e.g. compiling clang or llvm in a
special debug mode, linking in special debug versions of STL and
llvm/ADT/ that will cause crashes more reliably.
Apparently VS has a feature like that, c.f.
http://stackoverflow.com/questions/2062956/c-best-way-to-check-if-an-iterator-is-valid


>
> Cheers,
> Rafael




More information about the cfe-commits mailing list