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

2024-02-13 Thread Ties Klappe via Gcc
ical example that would allow GCC to optimize it? int foo3(int *restrict * p, int *restrict * q) { int a; *p = &a; **q = 11; **p = 12; return **q; } Kind regards, Ties Op di 13 feb 2024 om 15:29 schreef Joseph Myers : > On Tue, 13 Feb 2024, Ties Klappe via Gcc wrote: >

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 *foo2*

Re: Unjustified optimization due to restricted struct members?

2023-11-30 Thread Ties Klappe via Gcc
required? I would have expected to see the same optimization as is performed for the struct example. Kind regards, Ties Op do 30 nov 2023 om 13:16 schreef Richard Biener < richard.guent...@gmail.com>: > On Thu, Nov 30, 2023 at 12:07 PM Ties Klappe via Gcc > wrote: > > > &

Unjustified optimization due to restricted struct members?

2023-11-30 Thread Ties Klappe via Gcc
When reading section 6.7.3.1 of the C standard (quoted below) about the *restrict *type qualifier, the first section talks about *ordinary identifiers*. These are defined in section 6.2.3, and exclude members of structures. Let D be a declaration of an ordinary identifier that provides a means of