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

            Bug ID: 69819
           Summary: ICE on invalid code on x86_64-linux-gnu in tree check:
                    expected function_type or method_type, have array_type
                    in function_args_iter_init, at tree.h:4536
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk on
x86_64-linux-gnu.  

It is a regression from 5.3.x. 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160213 (experimental) [trunk revision 233402] (GCC)
$
$ 
$ 
$ gcc-5.3 -c small.c
small.c:3:5: error: ‘foo’ redeclared as different kind of symbol
 int foo[] = { 0 };
     ^
small.c:1:6: note: previous definition of ‘foo’ was here
 void foo () { }
      ^
$
$ 
$ 
$ gcc-trunk -c small.c
small.c:3:5: error: ‘foo’ redeclared as different kind of symbol
 int foo[] = { 0 };
     ^~~
small.c:1:6: note: previous definition of ‘foo’ was here
 void foo () { }
      ^~~
small.c: In function ‘foo’:
small.c:1:6: internal compiler error: tree check: expected function_type or
method_type, have array_type in function_args_iter_init, at tree.h:4536
0xda23dc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc-trunk/gcc/tree.c:9637
0xdaf389 tree_check2(tree_node const*, char const*, int, char const*,
tree_code, tree_code)
        ../../gcc-trunk/gcc/tree.h:3281
0xdaf389 function_args_iter_init
        ../../gcc-trunk/gcc/tree.h:4536
0xdaf389 stdarg_p(tree_node const*)
        ../../gcc-trunk/gcc/tree.c:11956
0xe3c1c1 init_cumulative_args(ix86_args*, tree_node*, rtx_def*, tree_node*,
int)
        ../../gcc-trunk/gcc/config/i386/i386.c:7708
0x86ee88 assign_parms_initialize_all
        ../../gcc-trunk/gcc/function.c:2293
0x875046 gimplify_parameters()
        ../../gcc-trunk/gcc/function.c:3980
0x8c3867 gimplify_body(tree_node*, bool)
        ../../gcc-trunk/gcc/gimplify.c:11290
0x8c3c16 gimplify_function_tree(tree_node*)
        ../../gcc-trunk/gcc/gimplify.c:11450
0x74cd17 cgraph_node::analyze()
        ../../gcc-trunk/gcc/cgraphunit.c:625
0x750083 analyze_functions
        ../../gcc-trunk/gcc/cgraphunit.c:1080
0x750d68 symbol_table::finalize_compilation_unit()
        ../../gcc-trunk/gcc/cgraphunit.c:2534
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.
$


-------------------------


void foo () { }

int foo[] = { 0 };

Reply via email to