Displaying 2 results from an estimated 2 matches for "subbuf4".
Did you mean:
subbuf
2018 Jun 13
2
Question about a May-alias case
Hi Eli,
Thanks for good comment! I missed to initalize the buf.
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'.
the IR snippet with '-O3' is
@subbuf1 = common global...
2018 Jun 13
2
Question about a May-alias case
Hello All,
I have a question about a May-alias case. Let's look at one simple C
example.
char *buf[4];
char c;
void test(int idx) {
char *a = buf[3 - idx];
char *b = buf[idx];
*a = *b;
c++;
*a = *b;
}
We can imagine the second "*a = *b" could be removed. Let's look at the
IR snippet with -O3 for above example.
1 define void @test(i32 %idx) {
2 entry: