public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/101374] [12 Regression] bootstrap failure varpool.c:490:19: error: array subscript 'varpool_node[0]' is partly outside array bounds of 'varpool_node [0]' [-Werror=array-bounds]
Date: Thu, 08 Jul 2021 09:22:14 +0000	[thread overview]
Message-ID: <bug-101374-4-HG00hmDK92@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101374-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following fails with -O2 -Wall -Werror after but not before the rev. - not
sure if the reduction is otherwise sensible.

template <typename T> struct reinterpret_is_a_helper {
  template <typename U> static T cast(U p) { return T(p); }
};
template <typename, typename U> bool is_a(U);
template <typename T, typename U> T dyn_cast(U p) {
  if (is_a<T>(p))
    return reinterpret_is_a_helper<T>::cast(p);
  return 0;
}
enum tree_node_structure_enum { TS_DECL_COMMON };
void contains_struct_check(int, tree_node_structure_enum, const char *, int,
                           const char *);
enum availability { AVAIL_NOT_AVAILABLE, AVAIL_AVAILABLE };
struct symtab_node {
  symtab_node *ultimate_alias_target();
  unsigned definition : 1;
  unsigned in_other_partition : 1;
};
struct varpool_node : symtab_node {
  availability get_availability();
  varpool_node *ultimate_alias_target(symtab_node *);
  unsigned : 1;
};
inline symtab_node *symtab_node::ultimate_alias_target() {
  dyn_cast<varpool_node *>(this)->get_availability();
  dyn_cast<varpool_node *>(this)->get_availability();
  return 0;
}
inline varpool_node *varpool_node::ultimate_alias_target(symtab_node *) {
  symtab_node __trans_tmp_1 = *symtab_node::ultimate_alias_target();
  varpool_node *n = dyn_cast<varpool_node *>(&__trans_tmp_1);
  return n;
}
availability varpool_node::get_availability() {
  symtab_node ref;
  if (definition && in_other_partition)
    return AVAIL_NOT_AVAILABLE;
  ultimate_alias_target(&ref);
  contains_struct_check(0, TS_DECL_COMMON, "", 5, __FUNCTION__);
  return AVAIL_AVAILABLE;
}

> /tmp/obj2/prev-gcc/cc1plus -quiet varpool.ii -O2 -Wall -Werror 
In member function 'availability varpool_node::get_availability()',
    inlined from 'symtab_node* symtab_node::ultimate_alias_target()' at
varpool.ii:25:51,
    inlined from 'varpool_node*
varpool_node::ultimate_alias_target(symtab_node*)' at varpool.ii:30:66,
    inlined from 'availability
varpool_node::_ZN12varpool_node16get_availabilityEv.part.0()' at
varpool.ii:38:24:
varpool.ii:36:18: error: array subscript 'varpool_node[0]' is partly outside
array bounds of 'varpool_node [0]' [-Werror=array-bounds]
   36 |   if (definition && in_other_partition)
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
varpool.ii: In member function 'availability
varpool_node::_ZN12varpool_node16get_availabilityEv.part.0()':
varpool.ii:19:8: note: object 'varpool_node::<anonymous>' of size 4
   19 | struct varpool_node : symtab_node {
      |        ^~~~~~~~~~~~
In member function 'availability varpool_node::get_availability()',
    inlined from 'symtab_node* symtab_node::ultimate_alias_target()' at
varpool.ii:26:51,
    inlined from 'varpool_node*
varpool_node::ultimate_alias_target(symtab_node*)' at varpool.ii:30:66,
    inlined from 'availability
varpool_node::_ZN12varpool_node16get_availabilityEv.part.0()' at
varpool.ii:38:24:
varpool.ii:36:18: error: array subscript 'varpool_node[0]' is partly outside
array bounds of 'varpool_node [0]' [-Werror=array-bounds]
   36 |   if (definition && in_other_partition)
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
varpool.ii: In member function 'availability
varpool_node::_ZN12varpool_node16get_availabilityEv.part.0()':
varpool.ii:19:8: note: object 'varpool_node::<anonymous>' of size 4
   19 | struct varpool_node : symtab_node {
      |        ^~~~~~~~~~~~
cc1plus: all warnings being treated as errors

  parent reply	other threads:[~2021-07-08  9:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08  7:43 [Bug bootstrap/101374] New: " rguenth at gcc dot gnu.org
2021-07-08  7:44 ` [Bug bootstrap/101374] " rguenth at gcc dot gnu.org
2021-07-08  7:48 ` rguenth at gcc dot gnu.org
2021-07-08  8:50 ` rguenth at gcc dot gnu.org
2021-07-08  9:22 ` rguenth at gcc dot gnu.org [this message]
2021-07-08  9:26 ` rguenth at gcc dot gnu.org
2021-07-08 10:46 ` schwab@linux-m68k.org
2021-07-08 14:47 ` schwab@linux-m68k.org
2021-07-08 14:47 ` schwab@linux-m68k.org
2021-07-08 14:49 ` msebor at gcc dot gnu.org
2021-07-08 15:47 ` msebor at gcc dot gnu.org
2021-07-08 17:44 ` cvs-commit at gcc dot gnu.org
2021-07-08 18:04 ` msebor at gcc dot gnu.org
2021-07-08 21:20 ` bergner at gcc dot gnu.org
2021-07-08 22:13 ` msebor at gcc dot gnu.org
2021-07-10  2:49 ` cvs-commit at gcc dot gnu.org
2021-07-13 16:10 ` msebor at gcc dot gnu.org
2021-07-16 16:33 ` abidh at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101374-4-HG00hmDK92@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).