(fts_build): Do not access freed pointer directly; instead,
save its bit-pattern into a uintptr_t, and use that to compare.
(ADJUST): Likewise, but more trickily since this hack
- puns pointer types and relies on undefined behavior.
+ actually accesses freed pointers, but does so in a way that
+ I hope GCC doesn’t notice. Although using ‘*(uintptr_t *) &P’
+ instead of ‘(uintptr_t) P’ would avoid accessing freed pointers,
+ it would provoke a -Wstrict-aliasing diagnostic.
* modules/fts (Depends-on): Add stdint.
2023-02-04 Bruno Haible <bruno@clisp.org>
trick does not work on your platform, please report a bug. */
#define ADJUST(p) do { \
- uintptr_t old_accpath = *(uintptr_t *) &(p)->fts_accpath; \
+ uintptr_t old_accpath = (uintptr_t) (p)->fts_accpath; \
if (old_accpath != (uintptr_t) (p)->fts_name) { \
(p)->fts_accpath = \
- addr + (old_accpath - *(uintptr_t *) &(p)->fts_path); \
+ addr + (old_accpath - (uintptr_t) (p)->fts_path); \
} \
(p)->fts_path = addr; \
} while (0)