[Bug middle-end/59752] New: Stack overflow on simple testcase
trippels at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jan 10 10:02:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59752
Bug ID: 59752
Summary: Stack overflow on simple testcase
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: trippels at gcc dot gnu.org
Jakub's testcase from PR59659 comment 7 with an array size of 100000
overflows the stack:
markus@x4 tmp % cat test.ii
struct S { S (); S (int); ~S (); int i; };
struct A { S s[100000]; };
void
foo ()
{
A a = {{}};
}
markus@x4 tmp % g++ -O2 -c test.ii
g++: internal compiler error: Segmentation fault (program cc1plus)
0x40ccef execute
../../gcc/gcc/gcc.c:2841
0x40cf57 do_spec_1
../../gcc/gcc/gcc.c:4641
0x40fccd process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fccd handle_braces
../../gcc/gcc/gcc.c:5838
0x40d6e2 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40fccd process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fccd handle_braces
../../gcc/gcc/gcc.c:5838
0x40d6e2 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40d2de do_spec_1
../../gcc/gcc/gcc.c:5410
0x40fccd process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fccd handle_braces
../../gcc/gcc/gcc.c:5838
0x40d6e2 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40fccd process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fccd handle_braces
../../gcc/gcc/gcc.c:5838
0x40d6e2 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40fccd process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fccd handle_braces
../../gcc/gcc/gcc.c:5838
0x40d6e2 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40fccd process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fccd handle_braces
../../gcc/gcc/gcc.c:5838
Please submit a full bug report,
with preprocessed source if appropriate.
Program received signal SIGSEGV, Segmentation fault.
[Switching to process 26558]
0x000000000073c6bf in cp_gimplify_expr (expr_p=0x7ffff4f5ae28,
pre_p=0x7ffffbfff7f8, post_p=0x7ffffbfff460) at
../../gcc/gcc/cp/cp-gimplify.c:532
532 {
(gdb) bt
#0 0x000000000073c6bf in cp_gimplify_expr (expr_p=0x7ffff4f5ae28,
pre_p=0x7ffffbfff7f8, post_p=0x7ffffbfff460) at
../../gcc/gcc/cp/cp-gimplify.c:532
#1 0x00000000009a085c in gimplify_expr (expr_p=expr_p@entry=0x7ffff4f5ae28,
pre_p=pre_p@entry=0x7ffffbfff7f8, post_p=<optimized out>,
post_p@entry=0x7ffffbfff460,
gimple_test_f=0x9819e0 <is_gimple_min_lval(tree_node*)>,
fallback=fallback@entry=3) at ../../gcc/gcc/gimplify.c:7350
#2 0x00000000009a83fc in gimplify_compound_lval
(expr_p=expr_p@entry=0x7ffff54d0ab8, pre_p=pre_p@entry=0x7ffffbfff7f8,
post_p=post_p@entry=0x7ffffbfff460,
fallback=fallback@entry=3) at ../../gcc/gcc/gimplify.c:1976
#3 0x00000000009a0ea7 in gimplify_expr (expr_p=expr_p@entry=0x7ffff54d0ab8,
pre_p=pre_p@entry=0x7ffffbfff7f8, post_p=<optimized out>,
gimple_test_f=gimple_test_f@entry=0x9986d0 <is_gimple_addressable(tree)>,
fallback=fallback@entry=3) at ../../gcc/gcc/gimplify.c:7393
#4 0x00000000009ac5e2 in gimplify_addr_expr
(expr_p=expr_p@entry=0x7fffee5c11f0, pre_p=pre_p@entry=0x7ffffbfff7f8,
post_p=post_p@entry=0x7ffffbfff460)
at ../../gcc/gcc/gimplify.c:4794
#5 0x00000000009a2ac2 in gimplify_expr (expr_p=0x7fffee5c11f0,
pre_p=pre_p@entry=0x7ffffbfff7f8, post_p=<optimized out>, post_p@entry=0x0,
gimple_test_f=0x9815e0 <is_gimple_val(tree_node*)>, fallback=<optimized
out>) at ../../gcc/gcc/gimplify.c:7487
#6 0x00000000009acc5c in gimplify_arg (arg_p=<optimized out>,
pre_p=pre_p@entry=0x7ffffbfff7f8, call_location=<optimized out>) at
../../gcc/gcc/gimplify.c:2184
#7 0x00000000009ae09a in gimplify_call_expr
(expr_p=expr_p@entry=0x7fffef5b4a58, pre_p=pre_p@entry=0x7ffffbfff7f8,
want_value=<optimized out>)
at ../../gcc/gcc/gimplify.c:2354
#8 0x00000000009a1c35 in gimplify_expr (expr_p=0x7fffef5b4a58,
pre_p=pre_p@entry=0x7ffffbfff7f8, post_p=<optimized out>, post_p@entry=0x0,
gimple_test_f=gimple_test_f@entry=0x99a6e0 <is_gimple_stmt(tree)>,
fallback=fallback@entry=0) at ../../gcc/gcc/gimplify.c:7412
#9 0x00000000009a59a7 in gimplify_stmt (stmt_p=<optimized out>,
seq_p=seq_p@entry=0x7ffffbfff7f8) at ../../gcc/gcc/gimplify.c:5334
#10 0x00000000009a1cdb in gimplify_cleanup_point_expr (pre_p=0x7ffffbfffad8,
expr_p=0x7fffef5aef40) at ../../gcc/gcc/gimplify.c:5110
#11 gimplify_expr (expr_p=0x7fffef5aef40, pre_p=pre_p@entry=0x7ffffbfffad8,
post_p=<optimized out>, post_p@entry=0x0,
gimple_test_f=gimple_test_f@entry=0x99a6e0 <is_gimple_stmt(tree)>,
fallback=fallback@entry=0) at ../../gcc/gcc/gimplify.c:7797
#12 0x00000000009a59a7 in gimplify_stmt (stmt_p=<optimized out>,
seq_p=seq_p@entry=0x7ffffbfffad8) at ../../gcc/gcc/gimplify.c:5334
#13 0x00000000009a1a5c in gimplify_statement_list (pre_p=0x7ffffbfffad8,
expr_p=0x7ffffbfffac0) at ../../gcc/gcc/gimplify.c:1405
#14 gimplify_expr (expr_p=0x7ffffbfffac0, pre_p=pre_p@entry=0x7ffffbfffad8,
post_p=<optimized out>, post_p@entry=0x0,
gimple_test_f=gimple_test_f@entry=0x99a6e0 <is_gimple_stmt(tree)>,
fallback=fallback@entry=0) at ../../gcc/gcc/gimplify.c:7849
#15 0x00000000009a59a7 in gimplify_stmt (stmt_p=stmt_p@entry=0x7ffffbfffac0,
seq_p=seq_p@entry=0x7ffffbfffad8) at ../../gcc/gcc/gimplify.c:5334
#16 0x00000000009a2b80 in gimplify_and_add (seq_p=0x7ffffbfffad8,
t=0x7fffef5b4a00) at ../../gcc/gcc/gimplify.c:384
#17 gimplify_expr (expr_p=0x7fffef5aef28, pre_p=pre_p@entry=0x7ffffbfffdb8,
post_p=<optimized out>, post_p@entry=0x0,
gimple_test_f=gimple_test_f@entry=0x99a6e0 <is_gimple_stmt(tree)>,
fallback=fallback@entry=0) at ../../gcc/gcc/gimplify.c:7771
#18 0x00000000009a59a7 in gimplify_stmt (stmt_p=<optimized out>,
seq_p=seq_p@entry=0x7ffffbfffdb8) at ../../gcc/gcc/gimplify.c:5334
#19 0x00000000009a1a5c in gimplify_statement_list (pre_p=0x7ffffbfffdb8,
expr_p=0x7ffffbfffda0) at ../../gcc/gcc/gimplify.c:1405
#20 gimplify_expr (expr_p=0x7ffffbfffda0, pre_p=pre_p@entry=0x7ffffbfffdb8,
post_p=<optimized out>, post_p@entry=0x0,
gimple_test_f=gimple_test_f@entry=0x99a6e0 <is_gimple_stmt(tree)>,
fallback=fallback@entry=0) at ../../gcc/gcc/gimplify.c:7849
#21 0x00000000009a59a7 in gimplify_stmt (stmt_p=stmt_p@entry=0x7ffffbfffda0,
seq_p=seq_p@entry=0x7ffffbfffdb8) at ../../gcc/gcc/gimplify.c:5334
#22 0x00000000009a2b80 in gimplify_and_add (seq_p=0x7ffffbfffdb8,
t=0x7fffef5b4940) at ../../gcc/gcc/gimplify.c:384
#23 gimplify_expr (expr_p=0x7fffef5aeef8, pre_p=pre_p@entry=0x7ffffc000098,
post_p=<optimized out>, post_p@entry=0x0,
...
==25997== Stack overflow in thread 1: can't grow stack to 0xffe801ff8
==25997== Can't extend stack to 0xffe8010a8 during signal delivery for thread
1:
==25997== no stack segment
==25997==
==25997== Process terminating with default action of signal 11 (SIGSEGV)
==25997== Access not within mapped region at address 0xFFE8010A8
==25997== at 0xAB2999: pointer_set_insert(pointer_set_t*, void const*)
(pointer-set.c:123)
Perf shows:
76.68% cc1plus libc-2.18.90.so [.] _wordcopy_fwd_aligned
2.68% cc1plus cc1plus [.] walk_tree_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, pointer_set_t*, tree_node*
(*)(tree_node**, int*, tree_node
1.57% cc1plus cc1plus [.] pointer_set_lookup(pointer_set_t const*,
void const*, unsigned long*)
0.88% cc1plus cc1plus [.] cp_genericize_r(tree_node**, int*, void*)
0.71% cc1plus cc1plus [.] gt_ggc_mx_lang_tree_node(void*)
0.69% cc1plus libc-2.18.90.so [.] memset
0.64% cc1plus cc1plus [.] pointer_set_insert(pointer_set_t*, void
const*)
More information about the Gcc-bugs
mailing list