[llvm-dev] Question about a May-alias case
JinGu Kang via llvm-dev
llvm-dev at lists.llvm.org
Wed Jun 13 16:40:58 PDT 2018
um... you are right... Thank you very much for good comment! :)
On 14 Jun 2018, 00:17, at 00:17, "Friedman, Eli" <efriedma at codeaurora.org> wrote:
>On 6/13/2018 3:50 PM, JinGu wrote:
>> Let's slightly change the example as below.
>>
>> char subbuf1[2];
>> char subbuf2[2];
>> char subbuf3[2];
>> char subbuf4[2];
>> char *buf[4] = {subbuf1, subbuf2, subbuf3, subbuf4};
>> char c;
>> void test(int idx) {
>> char *a = buf[3 - idx];
>> char *b = buf[idx];
>> *a = *b;
>> c++;
>> *a = *b;
>> }
>>
>> I think we can say the 'buf' does not point 'c'.
>
>That doesn't help... the compiler still can't prove whether some other
>translation unit modifies buf.
>
>If you declare buf as `char *const buf[4] = {subbuf1, subbuf2, subbuf3,
>
>subbuf4};`, then I guess you could prove that the pointers in buf don't
>
>point to c. But that's a rare pattern in practice, and it would be
>kind
>of expensive to analyze in BasicAA. Maybe if we add stateful AA to
>LLVM
>eventually.
>
>-Eli
>
>--
>Employee of Qualcomm Innovation Center, Inc.
>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
>Linux Foundation Collaborative Project
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180614/934ff1ea/attachment-0001.html>
More information about the llvm-dev
mailing list