Re: GCC16 or 17: when is the pointed type relevant for emitted assembler code?
Richard Biener via Gcc <[email protected]>
| Newsgroups | gmane.comp.gcc.devel |
|---|---|
| Message-ID | <CAFiYyc1HKR-j-czYd5L=jAR59ZdvpUafQjR8eokiR9wmC6E9ng@mail.gmail.com> |
On Fri, May 8, 2026 at 8:59 AM Basile STARYNKEVITCH <[email protected]> wrote: > > Hello all, > > Assume GCC16 (or future GCC17) targetting a common Von Neumann 64 bits > architecture (eg RISCV, AMD64, ARM-Aarch64, POWERPC-64). > > Are there cases where the pointed type changes the generated code. > > To be more concrete, I am thinking of generated C99 or C17 code (not > human written one). > > If every generated pointer was void* and at every dereferencing > occurrence explicitly casted to the actual data pointer, does that make > any difference in generated assembler code? > > In other words, is declaring only void* fields and local variables and > casting them on every dereferencing use makes a difference in generated > code. > > My guess is no, but I could be wrong. It makes a difference if the pointers reside in memory and for the access to that. struct { void *p; } vs. struct { int *p; } behaves differently wrt TBAA. > > Thanks > > -- > > Basile STARYNKEVITCH > <[email protected]> > 8 rue de la Faïencerie > http://starynkevitch.net/Basile/ > 92340 Bourg-la-Reine > https://github.com/bstarynk > France > https://github.com/RefPerSys/RefPerSys > https://orcid.org/0000-0003-0908-5250