[Patch][AsmWriter] Prevent SegFault when printing IR.

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Jun 15 21:50:43 PDT 2015


Probably the right place for the test is somewhere in unittests/IR/.  You
can construct whatever IR you need to repro, print in whatever way you
need to create a crash, and then check that the string is sane.

If you're not sure why the check is necessary (i.e., how to repro), then
you should figure that out first.  Perhaps some Instruction is being
printed that doesn't belong to a Function, or a Function is being
printed that doesn't belong to a Module?

> On 2015 Jun 15, at 18:29, Tyler Nowicki <tnowicki at apple.com> wrote:
> 
> I’m not sure how to write a test-case for that. Can you suggest something?
> 
> Tyler
> 
>> On Jun 15, 2015, at 6:28 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>> 
>> 
>>> On 2015-Jun-15, at 18:23, Tyler Nowicki <tnowicki at apple.com> wrote:
>>> 
>>> Hi,
>>> 
>>> When printing IR for each pass sometimes a call to printMetadataAttachments from InstCombiner will produce a seg-fault because it is dereferencing bad pointer. I’m not exactly sure whats happening here. But here is a patch to prevent the seg-fault.
>>> 
>>> Tyler
>>> 
>>> <0001-Prevent-segfault-when-printing-loop-hint-metadata.patch>_______________________________________________
>> 
>> Testcase?
>> 
> 





More information about the llvm-commits mailing list