Re: Nested restrict pointers: missed optimization & client with UB?

2024-02-13 Thread Richard Biener via Gcc
> Am 13.02.2024 um 16:27 schrieb Ties Klappe via Gcc : > > Thank you both for your quick replies. > > @Joseph, thank you for linking me to the other issue. If I understand > correctly what the point is, would you then agree that the program main > when calling foo2 has *defined* behavior? >

Re: Nested restrict pointers: missed optimization & client with UB?

2024-02-13 Thread Joseph Myers via Gcc
On Tue, 13 Feb 2024, Ties Klappe via Gcc wrote: > Thank you both for your quick replies. > > @Joseph, thank you for linking me to the other issue. If I understand > correctly what the point is, would you then agree that the program main > when calling foo2 has *defined* behavior? I think that's

Re: Nested restrict pointers: missed optimization & client with UB?

2024-02-13 Thread Ties Klappe via Gcc
Thank you both for your quick replies. @Joseph, thank you for linking me to the other issue. If I understand correctly what the point is, would you then agree that the program main when calling foo2 has *defined* behavior? What surprises me is that *p and *q might be the same restricted pointer:

Re: Nested restrict pointers: missed optimization & client with UB?

2024-02-13 Thread Joseph Myers via Gcc
On Tue, 13 Feb 2024, Ties Klappe via Gcc wrote: > int foo2(int *restrict *p, int *restrict *q) > { > **p = 10; > **q = 11; > return **p; > } In this case, *p and *q might be the same restricted pointer object. See the more detailed explanation at

Re: Nested restrict pointers: missed optimization & client with UB?

2024-02-13 Thread Richard Biener via Gcc
On Tue, Feb 13, 2024 at 2:02 PM Ties Klappe via Gcc wrote: > > Hi, > > I have two questions related to nested restrict pointers. > GCC 13.02 with optimization level 3 optimizes the function *foo1* to simply > return 10. > > int foo1(int *restrict *restrict p, int *restrict *restrict q) > { >

Nested restrict pointers: missed optimization & client with UB?

2024-02-13 Thread Ties Klappe via Gcc
Hi, I have two questions related to nested restrict pointers. GCC 13.02 with optimization level 3 optimizes the function *foo1* to simply return 10. int foo1(int *restrict *restrict p, int *restrict *restrict q) { **p = 10; **q = 11; return **p; } I am curious why the function