Displaying 2 results from an estimated 2 matches for "assign1".
Did you mean:
assign
2020 Feb 14
2
Given one restrict pointer based on another, should they never alias?
...other, should they never alias?
As far as I understand the formal definition of "restrict" in section
6.7.3.1 of the C standard [1], in the function below, pointer `y` is based
on "restrict" pointer `x`; hence, the compiler will assume that accesses *x
and *y might alias:
void assign1(int *pA, long N) {
int *restrict x = pA;
{
int *y = x + N;
*x = *y;
}
}
However, what if y itself is declared "restrict": can the compiler assume
that *x and *y will never alias?
void assign2(int *pA, long N) {
int *restrict x = pA;
{
int *restrict y = x + N;...
2020 Feb 20
2
Given one restrict pointer based on another, should they never alias?
...AM Jeroen Dobbelaere <
Jeroen.Dobbelaere at synopsys.com> wrote:
> Hi Alexey,
>
>
>
> This is defined in 6.7.3.1 paragraph 4:
>
> '... Every other lvalue used to access the value of X shall also have its
> address based on P ...'
>
>
>
> For 'assign1':
>
> - x is a restrict pointer and is assumed to point to its own set of objects
>
> - y is a normal pointer, based on x
>
> - all access to the set of objects pointed by x are done through a pointer
> based on x
>
>
>
> for 'assign2':
>
> - x is...