public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96636] New: ICE in build_value_init_noctor, at cp/init.c:451
@ 2020-08-17  1:59 haoxintu at gmail dot com
  2020-08-18 13:43 ` [Bug c++/96636] " mpolacek at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: haoxintu at gmail dot com @ 2020-08-17  1:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96636
           Summary: ICE in build_value_init_noctor, at cp/init.c:451
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Input:
//small.cc
typedef class {
  class a {}; 
  class : virtual a {};
} b;
void foo(){ b{};}

Command:
g++ small.cc

Output:
small.cc: In function ‘void foo()’:
small.cc:5:15: internal compiler error: in build_value_init_noctor, at
cp/init.c:451
    5 | void foo(){ b{};}
      |               ^
0x659bfa build_value_init_noctor(tree_node*, int)
        ../../gcc/cp/init.c:451
0x978b75 build_value_init(tree_node*, int)
        ../../gcc/cp/init.c:379
0x8adee2 build_new_method_call_1
        ../../gcc/cp/call.c:10234
0x8b1b90 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc/cp/call.c:10467
0x8b1b90 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        ../../gcc/cp/call.c:9870
0x8b2134 perform_direct_initialization_if_possible(tree_node*, tree_node*,
bool, int)
        ../../gcc/cp/call.c:11966
0xab5b79 build_static_cast_1
        ../../gcc/cp/typeck.c:7481
0xab6f12 cp_build_c_cast(unsigned int, tree_node*, tree_node*, int)
        ../../gcc/cp/typeck.c:8298
0xac04ed build_functional_cast_1
        ../../gcc/cp/typeck2.c:2380
0xac04ed build_functional_cast(unsigned int, tree_node*, tree_node*, int)
        ../../gcc/cp/typeck2.c:2413
0xa6fda7 finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        ../../gcc/cp/semantics.c:2977
0x9cc33a cp_parser_functional_cast
        ../../gcc/cp/parser.c:29684
0x9e4917 cp_parser_postfix_expression
        ../../gcc/cp/parser.c:7251
0x9c665a cp_parser_binary_expression
        ../../gcc/cp/parser.c:9641
0x9c83ee cp_parser_assignment_expression
        ../../gcc/cp/parser.c:9946
0x9c8712 cp_parser_expression
        ../../gcc/cp/parser.c:10114
0x9cbdf8 cp_parser_expression_statement
        ../../gcc/cp/parser.c:11774
0x9d72eb cp_parser_statement
        ../../gcc/cp/parser.c:11570
0x9d8ccd cp_parser_statement_seq_opt
        ../../gcc/cp/parser.c:11921
0x9d8da8 cp_parser_compound_statement
        ../../gcc/cp/parser.c:11871
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.

Noted that all GCC-5 onwards versions behave the same.

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

* [Bug c++/96636] ICE in build_value_init_noctor, at cp/init.c:451
  2020-08-17  1:59 [Bug c++/96636] New: ICE in build_value_init_noctor, at cp/init.c:451 haoxintu at gmail dot com
@ 2020-08-18 13:43 ` mpolacek at gcc dot gnu.org
  2021-07-27  5:13 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-18 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2020-08-18

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/96636] ICE in build_value_init_noctor, at cp/init.c:451
  2020-08-17  1:59 [Bug c++/96636] New: ICE in build_value_init_noctor, at cp/init.c:451 haoxintu at gmail dot com
  2020-08-18 13:43 ` [Bug c++/96636] " mpolacek at gcc dot gnu.org
@ 2021-07-27  5:13 ` pinskia at gcc dot gnu.org
  2021-07-27  5:17 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-27  5:13 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.1.2

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
4.1.2 used to accept this code without any error message (well changing b{} to
b()).

4.4.7 gives:
<source>: In function 'void foo()':
<source>:3: error: 'b::<anonymous struct>::._1()' is inaccessible
<source>:5: error: within this context

4.5.3 adds:
<source>:5:16: error: using result of function returning 'void'

4.6+ change the last error message into an ICE

4.8.1 gives a better error message:
<source>:3:11: error: 'b::<anonymous struct>::<constructor>()' is inaccessible
   struct  : virtual a {};
           ^
<source>:5:15: error: within this context
 void foo(){ b();}
               ^

4.9 ICEs in:
source>:5:16: internal compiler error: in count_type_elements, at expr.c:5620
 void foo(){ b();}
                ^
mmap: Invalid argument
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

5+ now ICEs in build_value_init_noctor.

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

* [Bug c++/96636] ICE in build_value_init_noctor, at cp/init.c:451
  2020-08-17  1:59 [Bug c++/96636] New: ICE in build_value_init_noctor, at cp/init.c:451 haoxintu at gmail dot com
  2020-08-18 13:43 ` [Bug c++/96636] " mpolacek at gcc dot gnu.org
  2021-07-27  5:13 ` pinskia at gcc dot gnu.org
@ 2021-07-27  5:17 ` pinskia at gcc dot gnu.org
  2021-07-30 19:36 ` pinskia at gcc dot gnu.org
  2021-07-31 14:45 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-27  5:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note making the code valid by placing a name after "class : virtual a {}", GCC
works and does not crash.

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

* [Bug c++/96636] ICE in build_value_init_noctor, at cp/init.c:451
  2020-08-17  1:59 [Bug c++/96636] New: ICE in build_value_init_noctor, at cp/init.c:451 haoxintu at gmail dot com
                   ` (2 preceding siblings ...)
  2021-07-27  5:17 ` pinskia at gcc dot gnu.org
@ 2021-07-30 19:36 ` pinskia at gcc dot gnu.org
  2021-07-31 14:45 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-30 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Should be fixed by
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576431.html which rejects
this code.

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

* [Bug c++/96636] ICE in build_value_init_noctor, at cp/init.c:451
  2020-08-17  1:59 [Bug c++/96636] New: ICE in build_value_init_noctor, at cp/init.c:451 haoxintu at gmail dot com
                   ` (3 preceding siblings ...)
  2021-07-30 19:36 ` pinskia at gcc dot gnu.org
@ 2021-07-31 14:45 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-31 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:af76342b444948ab262b276cdf083c2d2e0cebbb

commit r12-2653-gaf76342b444948ab262b276cdf083c2d2e0cebbb
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jul 30 16:49:03 2021 -0400

    c++: ICE on anon struct with base [PR96636]

    pinski pointed out that my recent change to reject anonymous structs with
    bases was relevant to this PR.  But we still ICEd after giving that error;
    this fixes the ICE.

            PR c++/96636

    gcc/cp/ChangeLog:

            * decl.c (fixup_anonymous_aggr): Clear TYPE_NEEDS_CONSTRUCTING
            after error.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/anon-struct9.C: New test.

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

end of thread, other threads:[~2021-07-31 14:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17  1:59 [Bug c++/96636] New: ICE in build_value_init_noctor, at cp/init.c:451 haoxintu at gmail dot com
2020-08-18 13:43 ` [Bug c++/96636] " mpolacek at gcc dot gnu.org
2021-07-27  5:13 ` pinskia at gcc dot gnu.org
2021-07-27  5:17 ` pinskia at gcc dot gnu.org
2021-07-30 19:36 ` pinskia at gcc dot gnu.org
2021-07-31 14:45 ` cvs-commit 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).