Fwd: gcc internal failure during optimization delete_trivially_dead_insns

ftwilliam ftwilliam@gmail.com
Mon Apr 6 19:37:00 GMT 2015


Hi Jeff,

Please see below output of valgrind


valgrind /home/user/Documents/gccbuild2/./gcc/cc1 -isystem
/opt/negroretoolchain/myarch-elf/include -isystem
/opt/negroretoolchain/myarch-elf/sys-include -fexceptions
/tmp/conftest.c
==28740== Memcheck, a memory error detector
==28740== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==28740== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==28740== Command: /home/user/Documents/gccbuild2/./gcc/cc1 -isystem
/opt/negroretoolchain/myarch-elf/include -isystem
/opt/negroretoolchain/myarch-elf/sys-include -fexceptions
/tmp/conftest.c
==28740==
==28740== Invalid read of size 16
==28740==    at 0x85EF051: search_line_sse2(unsigned char const*,
unsigned char const*) (lex.c:380)
==28740==    by 0x85EF707: _cpp_clean_line (lex.c:843)
==28740==    by 0x85EF9F3: _cpp_get_fresh_line.part.5 (lex.c:2141)
==28740==    by 0x85F177C: _cpp_lex_direct (lex.c:2129)
==28740==    by 0x85F2488: _cpp_lex_token (lex.c:2080)
==28740==    by 0x85F6937: cpp_get_token_1(cpp_reader*, unsigned int*)
(macro.c:2352)
==28740==    by 0x812B286: c_lex_with_flags(tree_node**, unsigned
int*, unsigned char*, int) (c-lex.c:300)
==28740==    by 0x80E630F: c_lex_one_token(c_parser*, c_token*) (c-parser.c:218)
==28740==    by 0x80F8888: c_parse_file() (c-parser.c:398)
==28740==    by 0x812F5C4: c_common_parse_file() (c-opts.c:1052)
==28740==    by 0x8395B12: compile_file() (toplev.c:543)
==28740==    by 0x8397733: toplev_main(int, char**) (toplev.c:1867)
==28740==  Address 0x4374560 is 8 bytes before a block of size 482 alloc'd
==28740==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==28740==    by 0x8620FC9: xmalloc (xmalloc.c:147)
==28740==    by 0x85EC370: read_file(cpp_reader*, _cpp_file*) (files.c:693)
==28740==    by 0x85ED178: _cpp_stack_file (files.c:794)
==28740==    by 0x85EEE3C: cpp_read_main_file(cpp_reader*, char
const*) (init.c:605)
==28740==    by 0x812EE26: c_common_post_options(char const**) (c-opts.c:978)
==28740==    by 0x839704E: toplev_main(int, char**) (toplev.c:1219)
==28740==    by 0x80BE21A: main (main.c:36)
==28740==
 foo
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <early_local_cleanups>
<*free_inline_summary> <emutls> <whole-program>Assembling functions:
 foo==28740== Invalid read of size 4
==28740==    at 0x85585BF: count_reg_usage(rtx_def*, int*, rtx_def*,
int) (cse.c:6664)
==28740==    by 0x855868A: count_reg_usage(rtx_def*, int*, rtx_def*,
int) (cse.c:6705)
==28740==    by 0x85627F8: delete_trivially_dead_insns(rtx_def*, int)
(cse.c:6941)
==28740==    by 0x853E6A8: execute_jump() (cfgcleanup.c:3059)
==28740==    by 0x832F88E: execute_one_pass(opt_pass*) (passes.c:2333)
==28740==    by 0x832FC64: execute_pass_list(opt_pass*) (passes.c:2381)
==28740==    by 0x832FC77: execute_pass_list(opt_pass*) (passes.c:2382)
==28740==    by 0x8191C0A: expand_function(cgraph_node*) (cgraphunit.c:1640)
==28740==    by 0x81933FD: compile() (cgraphunit.c:1833)
==28740==    by 0x8193659: finalize_compilation_unit() (cgraphunit.c:2119)
==28740==    by 0x80CEF85: c_write_global_declarations() (c-decl.c:10120)
==28740==    by 0x8395B64: compile_file() (toplev.c:557)
==28740==  Address 0x440554c is 4 bytes before a block of size 112 alloc'd
==28740==    at 0x402C109: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==28740==    by 0x8621000: xcalloc (xmalloc.c:162)
==28740==    by 0x85627B4: delete_trivially_dead_insns(rtx_def*, int)
(cse.c:6938)
==28740==    by 0x853E6A8: execute_jump() (cfgcleanup.c:3059)
==28740==    by 0x832F88E: execute_one_pass(opt_pass*) (passes.c:2333)
==28740==    by 0x832FC64: execute_pass_list(opt_pass*) (passes.c:2381)
==28740==    by 0x832FC77: execute_pass_list(opt_pass*) (passes.c:2382)
==28740==    by 0x8191C0A: expand_function(cgraph_node*) (cgraphunit.c:1640)
==28740==    by 0x81933FD: compile() (cgraphunit.c:1833)
==28740==    by 0x8193659: finalize_compilation_unit() (cgraphunit.c:2119)
==28740==    by 0x80CEF85: c_write_global_declarations() (c-decl.c:10120)
==28740==    by 0x8395B64: compile_file() (toplev.c:557)
==28740==
==28740== Invalid read of size 4
==28740==    at 0x81B2315: df_install_refs(basic_block_def*,
vec<df_ref_d*, va_stack, vl_ptr>, df_reg_info**, df_ref_info*, bool)
[clone .isra.18] (df-scan.c:2634)
==28740==    by 0x81B2484: df_refs_add_to_chains(df_collection_rec*,
basic_block_def*, rtx_def*) (df-scan.c:2695)
==28740==    by 0x81B7190: df_bb_refs_record(int, bool) (df-scan.c:3628)
==28740==    by 0x81B7322: df_scan_blocks() (df-scan.c:670)
==28740==    by 0x81A6113: rest_of_handle_df_initialize() (df-core.c:738)
==28740==    by 0x832F88E: execute_one_pass(opt_pass*) (passes.c:2333)
==28740==    by 0x832FC64: execute_pass_list(opt_pass*) (passes.c:2381)
==28740==    by 0x832FC77: execute_pass_list(opt_pass*) (passes.c:2382)
==28740==    by 0x8191C0A: expand_function(cgraph_node*) (cgraphunit.c:1640)
==28740==    by 0x81933FD: compile() (cgraphunit.c:1833)
==28740==    by 0x8193659: finalize_compilation_unit() (cgraphunit.c:2119)
==28740==    by 0x80CEF85: c_write_global_declarations() (c-decl.c:10120)
==28740==  Address 0x4409e74 is 4 bytes before a block of size 140 alloc'd
==28740==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==28740==    by 0x8621067: xrealloc (xmalloc.c:177)
==28740==    by 0x81B399B: df_grow_reg_info() (df-scan.c:550)
==28740==    by 0x81B3BDF: df_scan_alloc(bitmap_head_def*) (df-scan.c:344)
==28740==    by 0x81A6005: rest_of_handle_df_initialize() (df-core.c:717)
==28740==    by 0x832F88E: execute_one_pass(opt_pass*) (passes.c:2333)
==28740==    by 0x832FC64: execute_pass_list(opt_pass*) (passes.c:2381)
==28740==    by 0x832FC77: execute_pass_list(opt_pass*) (passes.c:2382)
==28740==    by 0x8191C0A: expand_function(cgraph_node*) (cgraphunit.c:1640)
==28740==    by 0x81933FD: compile() (cgraphunit.c:1833)
==28740==    by 0x8193659: finalize_compilation_unit() (cgraphunit.c:2119)
==28740==    by 0x80CEF85: c_write_global_declarations() (c-decl.c:10120)
==28740==
==28740== Invalid read of size 4
==28740==    at 0x81B21E1: df_install_ref(df_ref_d*, df_reg_info*,
df_ref_info*, bool) (df-scan.c:2551)
==28740==    by 0x81B2323: df_install_refs(basic_block_def*,
vec<df_ref_d*, va_stack, vl_ptr>, df_reg_info**, df_ref_info*, bool)
[clone .isra.18] (df-scan.c:2634)
==28740==    by 0x81B2484: df_refs_add_to_chains(df_collection_rec*,
basic_block_def*, rtx_def*) (df-scan.c:2695)
==28740==    by 0x81B7190: df_bb_refs_record(int, bool) (df-scan.c:3628)
==28740==    by 0x81B7322: df_scan_blocks() (df-scan.c:670)
==28740==    by 0x81A6113: rest_of_handle_df_initialize() (df-core.c:738)
==28740==    by 0x832F88E: execute_one_pass(opt_pass*) (passes.c:2333)
==28740==    by 0x832FC64: execute_pass_list(opt_pass*) (passes.c:2381)
==28740==    by 0x832FC77: execute_pass_list(opt_pass*) (passes.c:2382)
==28740==    by 0x8191C0A: expand_function(cgraph_node*) (cgraphunit.c:1640)
==28740==    by 0x81933FD: compile() (cgraphunit.c:1833)
==28740==    by 0x8193659: finalize_compilation_unit() (cgraphunit.c:2119)
==28740==  Address 0x4 is not stack'd, malloc'd or (recently) free'd
==28740==

/tmp/conftest.c: In function ‘foo’:
/tmp/conftest.c:19:1: internal compiler error: Segmentation fault
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
==28740==
==28740== HEAP SUMMARY:
==28740==     in use at exit: 330,963 bytes in 2,017 blocks
==28740==   total heap usage: 3,308 allocs, 1,291 frees, 1,042,723
bytes allocated
==28740==
==28740== LEAK SUMMARY:
==28740==    definitely lost: 24 bytes in 2 blocks
==28740==    indirectly lost: 2,068 bytes in 3 blocks
==28740==      possibly lost: 8,016 bytes in 1 blocks
==28740==    still reachable: 320,855 bytes in 2,011 blocks
==28740==         suppressed: 0 bytes in 0 blocks
==28740== Rerun with --leak-check=full to see details of leaked memory
==28740==
==28740== For counts of detected and suppressed errors, rerun with: -v
==28740== ERROR SUMMARY: 6 errors from 4 contexts (suppressed: 0 from 0)

On Mon, Apr 6, 2015 at 1:46 PM, Jeff Law <law@redhat.com> wrote:
> On 04/06/2015 11:54 AM, ftwilliam wrote:
>>
>> I would greatly appreciate any pointers on why this is occurring.
>
> Looks like some kind of memory management problem.
>
> What (if anything) does valgrind report?
>
>
> Jeff



More information about the Gcc-help mailing list