Re: REVERSE_LIST macro aliasing issue
Andreas Schwab <[email protected]> Mon, 30 Mar 2026 21:52:02 +0200
| Newsgroups | gmane.comp.shells.bash.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Mär 30 2026, Sam James wrote: > The issue is REVERSE_LIST [1] calls list_reverse [2] which reverses the > linked list while doing accesses as GENERIC_LIST* [3], but the original > elements are PROCESS*. > > I think GCC has an exemption for doing this with void* but even that > isn't required to work by the standard. I think it either needs to be > done with char* or with GENERIC_LIST* marked with > __attribute__((may_alias)) (though that isn't portable). The portable way is to create a union out of the two types that share the initial member that is accessed by the REVERSE_LIST macro. -- Andreas Schwab, [email protected] GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."