public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/95728] New: [11 Regression] tree check: expected tree_list,  have error_mark in tsubst_copy_and_build, at cp/pt.c:19594
Date: Wed, 17 Jun 2020 19:41:39 +0000	[thread overview]
Message-ID: <bug-95728-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 95728
           Summary: [11 Regression] tree check: expected tree_list, have
                    error_mark in tsubst_copy_and_build, at cp/pt.c:19594
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: jason at gcc dot gnu.org
  Target Milestone: ---

The code below is invalid (attempting to cast const T* to void*) but dies with
an ICE since r11-423:

    PR c++/93286 - ICE with __is_constructible and variadic template.

    My GCC 10 patch for 93286 fixed the missing piece in tsubst's handling of
    lists vs. that in tsubst_copy_and_build, but it would be better to share
the
    code between them.

template<typename T>
  void
  construct(T* p)
  { ::new(static_cast<void*>(p)) T; }

template<typename T>
void
f(const T* t)
{
  construct(t);
}

int main()
{
  int i[1];
  f(i);
}


ice.cc: In instantiation of 'void construct(T*) [with T = const int]':
ice.cc:10:12:   required from 'void f(const T*) [with T = int]'
ice.cc:16:6:   required from here
ice.cc:4:11: error: invalid 'static_cast' from type 'const int*' to type
'void*'
    4 |   { ::new(static_cast<void*>(p)) T; }
      |           ^~~~~~~~~~~~~~~~~~~~~
ice.cc:4:5: internal compiler error: tree check: expected tree_list, have
error_mark in tsubst_copy_and_build, at cp/pt.c:19640
    4 |   { ::new(static_cast<void*>(p)) T; }
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x81ac46 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /home/jwakely/src/gcc/gcc/gcc/tree.c:9685
0x67d317 tree_check(tree_node*, char const*, int, char const*, tree_code)
        /home/jwakely/src/gcc/gcc/gcc/tree.h:3301
0x67d317 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:19640
0xa91287 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:18772
0xa93ab7 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:17879
0xa92db1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:18173
0xa90ba1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:17834
0xa90ba1 instantiate_decl(tree_node*, bool, bool)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:25653
0xac281b instantiate_pending_templates(int)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:25769
0x9cb4e0 c_parse_final_cleanups()
        /home/jwakely/src/gcc/gcc/gcc/cp/decl2.c:4899
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

             reply	other threads:[~2020-06-17 19:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 19:41 redi at gcc dot gnu.org [this message]
2020-06-17 19:41 ` [Bug c++/95728] " redi at gcc dot gnu.org
2020-06-17 23:16 ` mpolacek at gcc dot gnu.org
2020-06-17 23:20 ` mpolacek at gcc dot gnu.org
2020-06-18 12:33 ` cvs-commit at gcc dot gnu.org
2020-06-18 12:35 ` mpolacek 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-95728-4@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).