public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/101372] New: [12 Regression] Bootstrap failure compiling gcc/cp/module.cc
@ 2021-07-08  6:53 tnfchris at gcc dot gnu.org
  2021-07-08  7:42 ` [Bug bootstrap/101372] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2021-07-08  6:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101372

            Bug ID: 101372
           Summary: [12 Regression] Bootstrap failure compiling
                    gcc/cp/module.cc
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-*

At the current HEAD (g:852b11da11a181df517c0348df044354ff0656d6) the bootstrap
is broken with a number of -Werror failures such as

ibiberty/libiberty.a ../libdecnumber/libdecnumber.a
In file included from ../../gcc-fsf/gcc/c-family/c-common.h:26,
                 from ../../gcc-fsf/gcc/cp/cp-tree.h:40,
                 from ../../gcc-fsf/gcc/cp/module.cc:209:
In function ‘tree_node* identifier(const cpp_hashnode*)’,
    inlined from ‘bool module_state::read_macro_maps()’ at
../../gcc-fsf/gcc/cp/module.cc:16305:10:
../../gcc-fsf/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-fsf/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-fsf/gcc/tree.h:23,
                 from ../../gcc-fsf/gcc/c-family/c-common.h:26,
                 from ../../gcc-fsf/gcc/cp/cp-tree.h:40,
                 from ../../gcc-fsf/gcc/cp/module.cc:209:
../../gcc-fsf/gcc/tree-core.h: In member function ‘bool
module_state::read_macro_maps()’:
../../gcc-fsf/gcc/tree-core.h:1445:24: note: at offset -24 into object
‘tree_identifier::id’ of size 16
 1445 |   struct ht_identifier id;
      |                        ^~

The macro defined in gcc/tree.h:1089 

#define HT_IDENT_TO_GCC_IDENT(NODE) \
  ((tree) ((char *) (NODE) - sizeof (struct tree_common)))

does no null check on NODE which can then result in a value of -1 for the
resulting size_t.

I can't really see what caused this to be triggered, don't see a recent commit
that touched this (from a quick search).

Should a simple null check be added here?

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-07-08 22:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08  6:53 [Bug bootstrap/101372] New: [12 Regression] Bootstrap failure compiling gcc/cp/module.cc tnfchris at gcc dot gnu.org
2021-07-08  7:42 ` [Bug bootstrap/101372] " rguenth at gcc dot gnu.org
2021-07-08  7:50 ` rguenth at gcc dot gnu.org
2021-07-08  9:30 ` tnfchris at gcc dot gnu.org
2021-07-08 10:46 ` schwab@linux-m68k.org
2021-07-08 19:11 ` msebor at gcc dot gnu.org
2021-07-08 22:35 ` segher at gcc dot gnu.org
2021-07-08 22:40 ` cvs-commit at gcc dot gnu.org
2021-07-08 22:42 ` [Bug bootstrap/101372] [12 Regression] -Warray-bounds in gcc/cp/module.cc causing bootstrap failure msebor at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).