public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "asolokha at gmx dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/107218] New: [13 Regression] ICE in cp_gimplify_init_expr, at cp/cp-gimplify.cc:253
Date: Tue, 11 Oct 2022 17:00:37 +0000	[thread overview]
Message-ID: <bug-107218-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 107218
           Summary: [13 Regression] ICE in cp_gimplify_init_expr, at
                    cp/cp-gimplify.cc:253
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++ 13.0.0 20221009 snapshot (g:e95e91eccd022a4a3a86da2749809fbad9afd20e) ICEs
when compiling the following testcase, reduced from
clang/testsuite/SemaCXX/cxx2a-consteval.cpp from the clang 15.0.1 test suite,
w/ -std=c++20 -O1:

namespace std {
template <typename T>
struct remove_reference {
  using type = T;
};

template <typename T>
constexpr typename std::remove_reference<T>::type &&
move (T &&t) noexcept
{
  return static_cast<typename std::remove_reference<T>::type &&> (t);
}
}

consteval int
f_eval ()
{
  return 0;
}

struct Copy {
  int (*ptr) ();

  constexpr Copy (int (*p) () = nullptr) : ptr (p)
  {
  }
};

Copy *
test ()
{
  return new Copy (std::move (Copy (&f_eval)));
}

% g++-13 -std=c++20 -O1 -c rc4hkfes.cpp
rc4hkfes.cpp: In function 'Copy* test()':
rc4hkfes.cpp:32:37: error: taking address of an immediate function 'consteval
int f_eval()'
   32 |   return new Copy (std::move (Copy (&f_eval)));
      |                                     ^~~~~~~
rc4hkfes.cpp:32:46: internal compiler error: in cp_gimplify_init_expr, at
cp/cp-gimplify.cc:253
   32 |   return new Copy (std::move (Copy (&f_eval)));
      |                                              ^
0x6adbf7 cp_gimplify_init_expr
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/cp/cp-gimplify.cc:253
0x9eb5f7 cp_gimplify_expr(tree_node**, gimple**, gimple**)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/cp/cp-gimplify.cc:508
0xef9cce gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:16237
0xf0c527 gimplify_stmt(tree_node**, gimple**)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:7187
0xf0c527 gimplify_compound_expr
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:6380
0xf0c5c9 gimplify_compound_expr
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:6378
0xf0db89 gimplify_modify_expr_rhs
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:5682
0xf0e316 gimplify_modify_expr
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:6076
0xefa661 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:16328
0xefcf96 gimplify_stmt(tree_node**, gimple**)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:7187
0xf0b4fd gimplify_and_add(tree_node*, gimple**)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:492
0xf0b4fd gimplify_return_expr
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:1680
0xefae1a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:16590
0xefcf96 gimplify_stmt(tree_node**, gimple**)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:7187
0xefe7cc gimplify_cleanup_point_expr
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:6928
0xefb1e2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:16721
0xf1dfe2 gimplify_stmt(tree_node**, gimple**)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:7187
0xf1dfe2 gimplify_body(tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:17588
0xf1e46a gimplify_function_tree(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/gimplify.cc:17787
0xd39a97 cgraph_node::analyze()
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221009/work/gcc-13-20221009/gcc/cgraphunit.cc:676

I suspect it can be a duplicate of PR107198, though.

             reply	other threads:[~2022-10-11 17:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 17:00 asolokha at gmx dot com [this message]
2022-10-12  7:51 ` [Bug c++/107218] " marxin 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-107218-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).