On Fri, Jul 9, 2021 at 12:57 AM Martin Sebor via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > To unblock bootstrap this morning that was failing due to stricter > array bounds checking, I suppressed two -Warray-bounds instances > in cp/modules.cc without analyzing them, tracking the to-do in > pr101372. Now that I understand what's going on -- the warning > is behaving as designed, flagging accesses to one member via > a pointer derived from another -- I believe the suppression is > still appropriate but can be moved to the inline function that > does the access. Thanks to the recent improvements to warning > suppression (r12-1992 and related) this more targeted fix should > work reliably while also avoiding a recurrence of the warning in > future uses of the function. I have committed the attached patch > to make this change after testing it on x86_64-linux.
The way we handle libcpp identifiers as tree identifiers is indeed somewhat fishy, but it should be visible in more places (and likely also have TBAA issues). We're mating struct GTY(()) tree_identifier { struct tree_common common; struct ht_identifier id; }; and struct GTY(()) cpp_hashnode { struct ht_identifier ident; unsigned int is_directive : 1; unsigned int directive_index : 7; /* If is_directive, ... }; to access the common ht_identifier. I think it would be cleaner to wherever we do this to only expose ht_identifier * to whatever API is accessing that. Maybe with C++ overloading it's less bad than it sounds. It's of course all done to save memory, re-using string representations from the preprocessor for the tree representation of identifiers. Richard. > Martin