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++/84590] New: -fsanitize=undefined internal compiler error: tree check: expected constructor, have target_expr in split_nonconstant_init_1, at cp/typeck2.c:629


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

            Bug ID: 84590
           Summary: -fsanitize=undefined internal compiler error: tree
                    check: expected constructor, have target_expr in
                    split_nonconstant_init_1, at cp/typeck2.c:629
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
  Target Milestone: ---

Input:

void a() {
  struct {
    char b;
  } c {
    ~220 << 0
  };
}

Compiled with:

xgcc -x c++ -std=c++14 -O3 -fsanitize=undefined -c -

Output:

<stdin>: In function 'void a()':
<stdin>:5:10: warning: narrowing conversion of '(<ubsan routine call>, (-221 <<
0))' from 'int' to 'char' inside { } [-Wnarrowing]
<stdin>:6:3: internal compiler error: tree check: expected constructor, have
target_expr in split_nonconstant_init_1, at cp/typeck2.c:629
0x65e898 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /home/vegard/git/gcc/gcc/tree.c:9327
0x1416f79 tree_check(tree_node*, char const*, int, char const*, tree_code)
        /home/vegard/git/gcc/gcc/tree.h:3132
0x1416f79 split_nonconstant_init_1
        /home/vegard/git/gcc/gcc/cp/typeck2.c:628
0x142680d split_nonconstant_init(tree_node*, tree_node*)
        /home/vegard/git/gcc/gcc/cp/typeck2.c:753
0xb44f78 check_initializer
        /home/vegard/git/gcc/gcc/cp/decl.c:6380
0xbd8b3e cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        /home/vegard/git/gcc/gcc/cp/decl.c:7034
0xf9dd85 cp_parser_init_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:19665
0xfa2a97 cp_parser_simple_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:13009
0xfa8c88 cp_parser_block_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12827
0xfab154 cp_parser_declaration_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:12420
0xef6e13 cp_parser_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:10869
0xefb1eb cp_parser_statement_seq_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:11218
0xefbc8a cp_parser_compound_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:11172
0xf8fb9b cp_parser_function_body
        /home/vegard/git/gcc/gcc/cp/parser.c:21712
0xf8fb9b cp_parser_ctor_initializer_opt_and_function_body
        /home/vegard/git/gcc/gcc/cp/parser.c:21747
0xf98da5 cp_parser_function_definition_after_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:26648
0xf9f305 cp_parser_function_definition_from_specifiers_and_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:26565
0xf9f305 cp_parser_init_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:19436
0xfa2a97 cp_parser_simple_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:13009
0xfa8c88 cp_parser_block_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12827
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.

Version:

xgcc (GCC) 8.0.1 20180204 (experimental)

built from git fdae6180ad24fa6303fa046114f3e4b66b8db34d

Version 7.3.0 don't seem to be affected AFAICS. gcc trunk on godbolt.org (8.0.1
20180227) gives:

<source>: In function 'void a()':
<source>:5:10: warning: narrowing conversion of '(<ubsan routine call>, (-221
<< 0))' from 'int' to 'char' inside { } [-Wnarrowing]
     ~220 << 0
     ~~~~~^~~~
<source>:6:3: internal compiler error: tree check: expected constructor, have
target_expr in split_nonconstant_init_1, at cp/typeck2.c:629
   };
   ^
mmap: Invalid argument
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Test case was reduced using C-Reduce. There is no error without
-fsanitize=undefined.

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