This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/69912] New: [6 regression] ICE in build_ctor_subob_ref initializing a flexible array member


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

            Bug ID: 69912
           Summary: [6 regression] ICE in build_ctor_subob_ref
                    initializing a flexible array member
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

The following code crashes with today's top of trunk.  Looks like my r231665 is
the cause.

$ cat z.c && /home/msebor/build/gcc-trunk-svn/gcc/xgcc
-B/home/msebor/build/gcc-trunk-svn/gcc -Wall -Wextra -Wpedantic -xc++ z.c
struct S {
  int n; 
  char *a[];
};

void foo (const char *a)
{
  const S s = { 1, { a, "b" } };
}

z.c: In function âvoid foo(const char*)â:
z.c:8:31: warning: initialization of a flexible array member [-Wpedantic]
   const S s = { 1, { a, "b" } };
                               ^
z.c:8:31: error: invalid conversion from âconst char*â to âchar*â
[-fpermissive]
z.c:8:31: warning: ISO C++ forbids converting a string constant to âchar*â
[-Wpedantic]
z.c:8:31: internal compiler error: in build_ctor_subob_ref, at cp/tree.c:2596
0x7eab46 build_ctor_subob_ref(tree_node*, tree_node*, tree_node*)
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/tree.c:2596
0x7eae4b replace_placeholders_r
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/tree.c:2651
0xfe0572 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
        /home/msebor/scm/fsf/gcc-svn/gcc/tree.c:11525
0x7eafdb replace_placeholders(tree_node*, tree_node*)
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/tree.c:2676
0x6de3d5 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/typeck2.c:838
0x645f55 check_initializer
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/decl.c:6155
0x6649cc cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/decl.c:6783
0x760427 cp_parser_init_declarator
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:18645
0x76096b cp_parser_simple_declaration
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:12356
0x760cfa cp_parser_block_declaration
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:12232
0x761809 cp_parser_declaration_statement
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:11844
0x75e41b cp_parser_statement
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:10526
0x75ede4 cp_parser_statement_seq_opt
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:10804
0x75eeef cp_parser_compound_statement
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:10758
0x75f04d cp_parser_function_body
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:20638
0x75f04d cp_parser_ctor_initializer_opt_and_function_body
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:20674
0x75fb01 cp_parser_function_definition_after_declarator
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:25322
0x760754 cp_parser_function_definition_from_specifiers_and_declarator
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:25234
0x760754 cp_parser_init_declarator
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:18416
0x76096b cp_parser_simple_declaration
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:12356
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]