PING 2 [PATCH] correct handling of variable offset minus constant in -Warray-bounds (PR 100137)

Andreas Schwab schwab@linux-m68k.org
Thu Jul 8 10:41:31 GMT 2021


On Jul 07 2021, Marek Polacek via Gcc-patches wrote:

> On Wed, Jul 07, 2021 at 02:38:11PM -0600, Martin Sebor via Gcc-patches wrote:
>> I certainly will.  Pushed in r12-2132.
>
> I think this patch breaks bootstrap on x86_64:

It also breaks bootstrap on aarch64 and ia64 in stage2.

In file included from ../../gcc/c-family/c-common.h:26,
                 from ../../gcc/cp/cp-tree.h:40,
                 from ../../gcc/cp/module.cc:209:
In function 'tree_node* identifier(const cpp_hashnode*)',
    inlined from 'bool module_state::read_macro_maps()' at ../../gcc/cp/module.cc:16305:10:
../../gcc/tree.h:1089:58: error: array subscript -1 is outside array bounds of 'cpp_hashnode [288230376151711743]' [-Werror=array-bounds]
 1089 |   ((tree) ((char *) (NODE) - sizeof (struct tree_common)))
      |                                                          ^
../../gcc/cp/module.cc:277:10: note: in expansion of macro 'HT_IDENT_TO_GCC_IDENT'
  277 |   return HT_IDENT_TO_GCC_IDENT (HT_NODE (const_cast<cpp_hashnode *> (node)));
      |          ^~~~~~~~~~~~~~~~~~~~~
In file included from ../../gcc/tree.h:23,
                 from ../../gcc/c-family/c-common.h:26,
                 from ../../gcc/cp/cp-tree.h:40,
                 from ../../gcc/cp/module.cc:209:
../../gcc/tree-core.h: In member function 'bool module_state::read_macro_maps()':
../../gcc/tree-core.h:1445:24: note: at offset -24 into object 'tree_identifier::id' of size 16
 1445 |   struct ht_identifier id;
      |                        ^~

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Gcc-patches mailing list