<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 15 August 2017 at 08:56, Diana Picus via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Ugh, I'm not sure that last email made it through.<br>
<br>
Here's the IR with -Xclang -disable-llvm-passes, at r310400 and r310401:<br>
<a href="https://goo.gl/4n84SR" rel="noreferrer" target="_blank">https://goo.gl/4n84SR</a><br>
<a href="https://goo.gl/gxhxp9" rel="noreferrer" target="_blank">https://goo.gl/gxhxp9</a><br>
<br>
The diff between them is small enough so I don't think there's much<br>
point in reducing it further.<br>
Hope that helps.</blockquote><div><br></div><div>Yes, that helps a lot. The problem was that the implicitly-generated va_list struct for ARM wasn't getting the "CanPassInRegisters" flag set, and got passed indirectly (contrary to the ABI).</div><div><br></div><div>I've added a test for that kind of problem in r310982, and re-committed the patch as r310983.</div><div><br></div><div>Thanks for all your assistance here!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">
On 15 August 2017 at 17:51, Diana Picus <<a href="mailto:diana.picus@linaro.org">diana.picus@linaro.org</a>> wrote:<br>
> Actually, I'm not sure I need to reduce it, the diff between the IR<br>
> with -Xclang -no-llvm-passes is pretty small for the version<br>
> with/without the patch. See attached. I hope this helps, it does look<br>
> like a problem with va_arg handling.<br>
><br>
> Sorry again that this is going so slowly...<br>
><br>
> On 15 August 2017 at 16:52, Diana Picus <<a href="mailto:diana.picus@linaro.org">diana.picus@linaro.org</a>> wrote:<br>
>> On 15 August 2017 at 01:25, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
>>> On 14 August 2017 at 03:27, Diana Picus via cfe-commits<br>
>>> <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
>>>><br>
>>>> Hi,<br>
>>>><br>
>>>> Strangely enough, it turns out that if I run<br>
>>>> Asan-armhf-with-calls-Noinst-<wbr>Test on the command line it fails,<br>
>>>> although it doesn't fail when run with lit.<br>
>>><br>
>>><br>
>>> Looks like the crash is within the "use_colors == true" portion of<br>
>>> ColoredPrintf, so this would make sense if running the test within lit turns<br>
>>> off color support (perhaps because the output is not a terminal).<br>
>>><br>
>><br>
>> That's a good catch, it seems if I run it with --gtest-color=no it<br>
>> still passes, but prints some garbage at the end:<br>
>> [ PASSED ] 97 tests.<br>
>> YOU HAVE -1094542056 DISABLED F]�뀼��_8�pG����D2<br>
>><br>
>><br>
>>>><br>
>>>> I've attached the stack<br>
>>>> trace from gdb. It looks like some trouble passing down va_arg<br>
>>>> parameters, but I haven't looked into too much details. The segfault<br>
>>>> happens when we try to do a   ldrb   r3, [r0, r1], with r1 set to 0 by<br>
>>>> the current function and r0 passed down from the caller. I'm not sure<br>
>>>> if this is the exact same problem as the other tests, but feel free to<br>
>>>> have a look at that code.<br>
>>><br>
>>><br>
>>> Have you tried running Asan-armhf-with-calls-Noinst-<wbr>Test on the command line<br>
>>> without this patch applied? (It's possible that this is a pre-existing bug<br>
>>> in ARM varargs call lowering, and is unrelated to the bug we're trying to<br>
>>> track down. This code path performs an unrelated varargs call between a<br>
>>> va_start / va_end pair, which seems like quite a rare situation, and I could<br>
>>> easily believe there's something wrong with our lowering that allows some<br>
>>> portion of the outer va_list state to be clobbered in that scenario.)<br>
>>><br>
>><br>
>> It seems to work without the patch. I'm currently trying to reduce<br>
>> Asan-armhf-with-calls-Test and I'll get back to you with the IR or<br>
>> assembly files (whichever makes any difference).<br>
>><br>
>>>> Meanwhile, I've removed some clutter from Asan-armhf-with-calls-Test<br>
>>>> (which is the original failure that we were seeing) and left only one<br>
>>>> failing test that seemed small enough. I'll try to look at the<br>
>>>> disassembly before/after the patch and maybe even run valgrind on it<br>
>>>> (running it on the original binary naturally takes forever).<br>
>>>><br>
>>>> Let me know if there's anything else I could try. I can also send you<br>
>>>> disassembly or even LLVM IR for the Asan-armhf-with-calls-Noinst-<wbr>Test<br>
>>>> if you think it helps.<br>
>>>><br>
>>>> Cheers,<br>
>>>> Diana<br>
</div></div><div class="gmail-HOEnZb"><div class="gmail-h5">______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>