http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59711
Bug ID: 59711 Summary: ICE in force_constant_size, at gimplify.c:619 (nested function and variably-modified type) Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: fweimer at redhat dot com Created attachment 31764 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31764&action=edit u.c The attached test case ICEs on x86_64-redhat-linux-gnu with the following backtrace: #2 0x00000000007f5875 in force_constant_size (var=0x7ffff032a8e8) at ../../trunk/gcc/gimplify.c:619 #3 gimple_add_tmp_var (tmp=0x7ffff032a8e8) at ../../trunk/gcc/gimplify.c:638 #4 0x00000000007d58fb in create_tmp_var (type=type@entry=0x7ffff0328000, prefix=<optimized out>) at ../../trunk/gcc/gimple-expr.c:509 #5 0x00000000007f5b15 in create_tmp_from_val (is_formal=true, val=0x7ffff0324990) at ../../trunk/gcc/gimplify.c:457 #6 lookup_tmp_var (is_formal=true, val=0x7ffff0324990) at ../../trunk/gcc/gimplify.c:479 #7 internal_get_tmp_var (val=0x7ffff0324990, pre_p=0x7fffffffd968, post_p=<optimized out>, is_formal=<optimized out>) at ../../trunk/gcc/gimplify.c:523 #8 0x00000000007f627e in gimplify_expr (expr_p=expr_p@entry=0x7ffff03249d8, pre_p=pre_p@entry=0x7fffffffd968, post_p=post_p@entry=0x7fffffffd518, gimple_test_f=<optimized out>, fallback=fallback@entry=3) at ../../trunk/gcc/gimplify.c:8322 #9 0x00000000007fdea2 in gimplify_compound_lval (expr_p=expr_p@entry=0x7ffff0305ac0, pre_p=pre_p@entry=0x7fffffffd968, post_p=post_p@entry=0x7fffffffd518, fallback=fallback@entry=1) at ../../trunk/gcc/gimplify.c:1976 #10 0x00000000007f73cd in gimplify_expr (expr_p=expr_p@entry=0x7ffff0305ac0, pre_p=pre_p@entry=0x7fffffffd968, post_p=post_p@entry=0x7fffffffd518, gimple_test_f=<optimized out>, fallback=fallback@entry=1) at ../../trunk/gcc/gimplify.c:7383 #11 0x00000000008029bb in gimplify_modify_expr (expr_p=expr_p@entry=0x7fffffffd6b0, pre_p=pre_p@entry=0x7fffffffd968, post_p=post_p@entry=0x7fffffffd518, want_value=<optimized out>) at ../../trunk/gcc/gimplify.c:4493 #12 0x00000000007f771a in gimplify_expr (expr_p=0x7fffffffd6b0, pre_p=pre_p@entry=0x7fffffffd968, post_p=0x7fffffffd518, post_p@entry=0x0, gimple_test_f=gimple_test_f@entry=0x7efef0 <is_gimple_stmt(tree)>, fallback=fallback@entry=0) at ../../trunk/gcc/gimplify.c:7431 #13 0x00000000007fb0f7 in gimplify_stmt (stmt_p=stmt_p@entry=0x7fffffffd6b0, seq_p=seq_p@entry=0x7fffffffd968) at ../../trunk/gcc/gimplify.c:5334 #14 0x00000000007f970c in gimplify_and_add (seq_p=0x7fffffffd968, t=0x7ffff0305aa0) at ../../trunk/gcc/gimplify.c:384 #15 gimplify_return_expr (pre_p=0x7fffffffd968, stmt=0x7ffff0314a60) at ../../trunk/gcc/gimplify.c:1234 #16 gimplify_expr (expr_p=0x7ffff0312bc8, pre_p=pre_p@entry=0x7fffffffd968, post_p=0x7fffffffd698, post_p@entry=0x0, gimple_test_f=gimple_test_f@entry=0x7efef0 <is_gimple_stmt(tree)>, fallback=fallback@entry=0) at ../../trunk/gcc/gimplify.c:7671 #17 0x00000000007fb0f7 in gimplify_stmt (stmt_p=<optimized out>, seq_p=seq_p@entry=0x7fffffffd968) at ../../trunk/gcc/gimplify.c:5334 #18 0x00000000007f7ee4 in gimplify_statement_list (pre_p=0x7fffffffd968, expr_p=0x7ffff0324a10) at ../../trunk/gcc/gimplify.c:1405 #19 gimplify_expr (expr_p=0x7ffff0324a10, pre_p=pre_p@entry=0x7fffffffd968, post_p=0x7fffffffd818, post_p@entry=0x0, gimple_test_f=gimple_test_f@entry=0x7efef0 <is_gimple_stmt(tree)>, fallback=fallback@entry=0) at ../../trunk/gcc/gimplify.c:7839 #20 0x00000000007fb0f7 in gimplify_stmt (stmt_p=stmt_p@entry=0x7ffff0324a10, seq_p=seq_p@entry=0x7fffffffd968) at ../../trunk/gcc/gimplify.c:5334 #21 0x00000000007fc01e in gimplify_bind_expr (expr_p=expr_p@entry=0x7ffff030a698, pre_p=pre_p@entry=0x7fffffffdb58) at ../../trunk/gcc/gimplify.c:1072 #22 0x00000000007f7856 in gimplify_expr (expr_p=0x7ffff030a698, pre_p=pre_p@entry=0x7fffffffdb58, post_p=0x7fffffffda28, post_p@entry=0x0, gimple_test_f=gimple_test_f@entry=0x7efef0 <is_gimple_stmt(tree)>, fallback=fallback@entry=0) at ../../trunk/gcc/gimplify.c:7621 #23 0x00000000007fb0f7 in gimplify_stmt (stmt_p=stmt_p@entry=0x7ffff030a698, seq_p=seq_p@entry=0x7fffffffdb58) at ../../trunk/gcc/gimplify.c:5334 #24 0x00000000007fc9d0 in gimplify_body (fndecl=fndecl@entry=0x7ffff030a600, do_parms=do_parms@entry=true) at ../../trunk/gcc/gimplify.c:8531 #25 0x00000000007fd017 in gimplify_function_tree (fndecl=fndecl@entry=0x7ffff030a600) at ../../trunk/gcc/gimplify.c:8684 #26 0x000000000068d638 in analyze_function (node=node@entry=0x7ffff032b000) at ../../trunk/gcc/cgraphunit.c:649 #27 0x000000000068e9f5 in analyze_functions () at ../../trunk/gcc/cgraphunit.c:1017 #28 0x0000000000690036 in finalize_compilation_unit () at ../../trunk/gcc/cgraphunit.c:2310 #29 0x0000000000552704 in c_write_global_declarations () at ../../trunk/gcc/c/c-decl.c:10400 #30 0x00000000009a661d in compile_file () at ../../trunk/gcc/toplev.c:561 #31 0x00000000009a84b2 in do_compile () at ../../trunk/gcc/toplev.c:1887 #32 toplev_main (argc=21, argv=0x7fffffffde48) at ../../trunk/gcc/toplev.c:1963 #33 0x00007ffff6933b45 in __libc_start_main (main=0x535ca0 <main(int, char**)>, argc=21, ubp_av=0x7fffffffde48, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde38) at libc-start.c:274 #34 0x0000000000535ce5 in _start () The crash happens at: 617 max_size = max_int_size_in_bytes (TREE_TYPE (var)); 618 619 gcc_assert (max_size >= 0); var looks like this: <var_decl 0x7ffff032a8e8 D.1765 type <record_type 0x7ffff0328000 S sizes-gimplified type_0 type_1 BLK size <var_decl 0x7ffff032a7b8 D.1763 type <integer_type 0x7ffff01fe150 bitsizetype> used unsigned ignored TI file /tmp/u.c line 3 col 10 size <integer_cst 0x7ffff02000c0 constant 128> unit size <integer_cst 0x7ffff02000e0 constant 16> align 128 context <function_decl 0x7ffff030a600 f> chain <var_decl 0x7ffff032a720 D.1762>> unit size <var_decl 0x7ffff032a390 D.1756 type <integer_type 0x7ffff01fe0a8 sizetype> used unsigned ignored DI file /tmp/u.c line 3 col 10 size <integer_cst 0x7ffff0200040 constant 64> unit size <integer_cst 0x7ffff0200060 constant 8> align 64 context <function_decl 0x7ffff030a600 f> chain <var_decl 0x7ffff032a2f8 D.1755>> align 32 symtab 0 alias set -1 canonical type 0x7ffff0328000 fields <field_decl 0x7ffff032a000 a type <array_type 0x7ffff0328150> decl_0 BLK file /tmp/u.c line 4 col 9 size <var_decl 0x7ffff032a2f8 D.1755> unit size <var_decl 0x7ffff032a390 D.1756> align 32 offset_align 128 offset <integer_cst 0x7ffff0200080 constant 0> bit offset <integer_cst 0x7ffff0200100 constant 0> context <record_type 0x7ffff0328000 S>> context <function_decl 0x7ffff030a600 f> chain <type_decl 0x7ffff0329000 D.1744>> used ignored BLK file /tmp/u.c line 13 col 12 size <var_decl 0x7ffff032a7b8 D.1763> unit size <var_decl 0x7ffff032a390 D.1756> align 32>