public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107148] New: [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252
@ 2022-10-04  6:26 asolokha at gmx dot com
  2022-10-04  8:44 ` [Bug c++/107148] " marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: asolokha at gmx dot com @ 2022-10-04  6:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107148
           Summary: [10/11/12/13 Regression] ICE in bot_manip, at
                    cp/tree.cc:3252
           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 20220925 snapshot (g:77bbf69d2981dafc2ef3e59bfbefb645d88bab9d) ICEs
when compiling the following testcase, reduced from
test/Sema/stmt-expr-in-default-arg.cpp from the clang 15.0.1 test suite:

template <typename Callable>
int bar(Callable &&Call) {
  return Call();
}

int baz() {
  auto l = [](int a = ({ int x = 12; x; })) {
    return 1;
  };
  return bar(l);
}

% g++-13.0.0 -c wi2ugigv.cpp
wi2ugigv.cpp: In function 'int baz()':
wi2ugigv.cpp:7:30: error: ISO C++ forbids in-class initialization of non-const
static member 'baz()::<lambda>::x'
    7 |   auto l = [](int a = ({ int x = 12; x; })) { // expected-error
{{default argument may not use a GNU statement expression}}
      |                              ^
wi2ugigv.cpp:7:38: error: 'x' was not declared in this scope
    7 |   auto l = [](int a = ({ int x = 12; x; })) { // expected-error
{{default argument may not use a GNU statement expression}}
      |                                      ^
wi2ugigv.cpp:7:23: error: could not convert '({...})' from 'void' to 'int'
    7 |   auto l = [](int a = ({ int x = 12; x; })) { // expected-error
{{default argument may not use a GNU statement expression}}
      |                       ^~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       void
wi2ugigv.cpp: In instantiation of 'int bar(Callable&&) [with Callable =
baz()::<lambda(int)>&]':
wi2ugigv.cpp:10:13:   required from here
wi2ugigv.cpp:3:14: internal compiler error: in bot_manip, at cp/tree.cc:3252
    3 |   return Call();
      |          ~~~~^~
0x75052d bot_manip
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/tree.cc:3252
0x14f3003 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/tree.cc:11249
0xbd29f8 break_out_target_exprs(tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/tree.cc:3333
0x96fd52 convert_default_arg(tree_node*, tree_node*, tree_node*, int, int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/call.cc:8755
0x97d73f build_over_call
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/call.cc:9655
0x981621 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/call.cc:5137
0xbad4a1 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/semantics.cc:2925
0xb59a1d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:21204
0xb6f001 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:19722
0xb7036f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:18707
0xb6fdcd tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:19059
0xb837b6 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:18683
0xb837b6 instantiate_body
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:26657
0xb84994 instantiate_decl(tree_node*, bool, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:26949
0xb903b3 instantiate_pending_templates(int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:27027
0xa3e5cc c_parse_final_cleanups()
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/decl2.cc:4917
0xc6e3cf c_common_parse_file()
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/c-family/c-opts.cc:1273

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

* [Bug c++/107148] [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252
  2022-10-04  6:26 [Bug c++/107148] New: [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252 asolokha at gmx dot com
@ 2022-10-04  8:44 ` marxin at gcc dot gnu.org
  2022-10-04 14:01 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-04  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started likely with r11-7844-g6081d8994ed1a0ae.

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

* [Bug c++/107148] [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252
  2022-10-04  6:26 [Bug c++/107148] New: [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252 asolokha at gmx dot com
  2022-10-04  8:44 ` [Bug c++/107148] " marxin at gcc dot gnu.org
@ 2022-10-04 14:01 ` mpolacek at gcc dot gnu.org
  2022-10-06 10:08 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-10-04 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2022-10-04
             Status|UNCONFIRMED                 |NEW

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

* [Bug c++/107148] [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252
  2022-10-04  6:26 [Bug c++/107148] New: [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252 asolokha at gmx dot com
  2022-10-04  8:44 ` [Bug c++/107148] " marxin at gcc dot gnu.org
  2022-10-04 14:01 ` mpolacek at gcc dot gnu.org
@ 2022-10-06 10:08 ` rguenth at gcc dot gnu.org
  2022-11-16 22:00 ` jsm28 at gcc dot gnu.org
  2023-07-07 10:44 ` [Bug c++/107148] [11/12/13/14 Regression] ICE in bot_manip with statement expressions, " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-06 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Target Milestone|---                         |10.5

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

* [Bug c++/107148] [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252
  2022-10-04  6:26 [Bug c++/107148] New: [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-10-06 10:08 ` rguenth at gcc dot gnu.org
@ 2022-11-16 22:00 ` jsm28 at gcc dot gnu.org
  2023-07-07 10:44 ` [Bug c++/107148] [11/12/13/14 Regression] ICE in bot_manip with statement expressions, " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2022-11-16 22:00 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org

--- Comment #2 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
The following test produces the same ICE without any prior errors. I'm not sure
if a statement expression should be considered valid in this context, or if
that indicates that an earlier error is needed. Compile this test with
-fimplicit-constexpr (thus, needs GCC 12 or later, so this test does not show a
regression, unlike the ICE-on-invalid regression in the original bug report).

int f(int);
class A {
public:
  A(int);
};
class C {
  C() : m(f(({ int x = 1; x; }))) {}
  A m;
};

Alternatively, not needing -fimplicit-constexpr (rejected by GCC 10 and before;
GCC 11 and later ICE; so again not showing a regression):

int f(int);
class A {
public:
  A(int);
};
class C {
  constexpr C() : m(f(({ int x = 1; x; }))) {}
  A m;
};

The failing assertion is

          gcc_assert (VAR_P (*p) && DECL_ARTIFICIAL (*p) && !TREE_STATIC (*p));

where *p is the variable x in the statement expression, so fails
DECL_ARTIFICIAL. If this test is valid, I don't know if it should reach the
code with this assertion (or what additional issues might arise if the variable
in the statement expression were declared static).

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

* [Bug c++/107148] [11/12/13/14 Regression] ICE in bot_manip with statement expressions, at cp/tree.cc:3252
  2022-10-04  6:26 [Bug c++/107148] New: [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-11-16 22:00 ` jsm28 at gcc dot gnu.org
@ 2023-07-07 10:44 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04  6:26 [Bug c++/107148] New: [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252 asolokha at gmx dot com
2022-10-04  8:44 ` [Bug c++/107148] " marxin at gcc dot gnu.org
2022-10-04 14:01 ` mpolacek at gcc dot gnu.org
2022-10-06 10:08 ` rguenth at gcc dot gnu.org
2022-11-16 22:00 ` jsm28 at gcc dot gnu.org
2023-07-07 10:44 ` [Bug c++/107148] [11/12/13/14 Regression] ICE in bot_manip with statement expressions, " rguenth 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).