Hi Jeff, Please see below correct valgrind output corresponding to the error in the original message. The previous valgrind output accidentally came from a parallel build that used an older GCC. valgrind /home/user/Documents/gccbuild/./gcc/cc1 -isystem /opt/myarchtoolchain/myarch-elf/include -isystem /opt/myarchtoolchain/myarch-elf/sys-include -fexceptions /tmp/conftest.c ==29944== Memcheck, a memory error detector ==29944== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==29944== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info ==29944== Command: /home/user/Documents/gccbuild/./gcc/cc1 -isystem /opt/myarchtoolchain/myarch-elf/include -isystem /opt/myarchtoolchain/myarch-elf/sys-include -fexceptions /tmp/conftest.c ==29944== foo Analyzing compilation unit Performing interprocedural optimizations <*free_lang_data> <visibility> <early_local_cleanups> <*free_inline_summary> <emutls> <whole-program> <inline>Assembling functions: foo==29944== Invalid read of size 4 ==29944== at 0x8606C1F: count_reg_usage(rtx_def*, int*, rtx_def*, int) (cse.c:6691) ==29944== by 0x8606CEA: count_reg_usage(rtx_def*, int*, rtx_def*, int) (cse.c:6732) ==29944== by 0x8610EB8: delete_trivially_dead_insns(rtx_def*, int) (cse.c:6969) ==29944== by 0x85EC638: (anonymous namespace)::pass_jump::execute() (cfgcleanup.c:3085) ==29944== by 0x838F3E8: execute_one_pass(opt_pass*) (passes.c:2233) ==29944== by 0x838F665: execute_pass_list(opt_pass*) (passes.c:2286) ==29944== by 0x838F678: execute_pass_list(opt_pass*) (passes.c:2287) ==29944== by 0x81C20CE: expand_function(cgraph_node*) (cgraphunit.c:1774) ==29944== by 0x81C3E47: compile() (cgraphunit.c:2006) ==29944== by 0x81C40F9: finalize_compilation_unit() (cgraphunit.c:2329) ==29944== by 0x80E4555: c_write_global_declarations() (c-decl.c:10401) ==29944== by 0x83FC4CC: compile_file() (toplev.c:562) ==29944== Address 0x4427e54 is 4 bytes before a block of size 112 alloc'd ==29944== at 0x402C109: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==29944== by 0x86CCB00: xcalloc (xmalloc.c:162) ==29944== by 0x8610E74: delete_trivially_dead_insns(rtx_def*, int) (cse.c:6966) ==29944== by 0x85EC638: (anonymous namespace)::pass_jump::execute() (cfgcleanup.c:3085) ==29944== by 0x838F3E8: execute_one_pass(opt_pass*) (passes.c:2233) ==29944== by 0x838F665: execute_pass_list(opt_pass*) (passes.c:2286) ==29944== by 0x838F678: execute_pass_list(opt_pass*) (passes.c:2287) ==29944== by 0x81C20CE: expand_function(cgraph_node*) (cgraphunit.c:1774) ==29944== by 0x81C3E47: compile() (cgraphunit.c:2006) ==29944== by 0x81C40F9: finalize_compilation_unit() (cgraphunit.c:2329) ==29944== by 0x80E4555: c_write_global_declarations() (c-decl.c:10401) ==29944== by 0x83FC4CC: compile_file() (toplev.c:562) ==29944== ==29944== Invalid read of size 4 ==29944== at 0x81E5C6E: df_install_refs(basic_block_def*, vec<df_ref_d*, va_heap, vl_ptr> const*, df_reg_info**, df_ref_info*, bool) [clone .isra.17] (df-scan.c:2656) ==29944== by 0x81E5DCA: df_refs_add_to_chains(df_collection_rec*, basic_block_def*, rtx_def*, unsigned int) (df-scan.c:2715) ==29944== by 0x81EAA4C: df_bb_refs_record(int, bool) (df-scan.c:3643) ==29944== by 0x81EAC62: df_scan_blocks() (df-scan.c:679) ==29944== by 0x81D9323: rest_of_handle_df_initialize() (df-core.c:737) ==29944== by 0x838F3E8: execute_one_pass(opt_pass*) (passes.c:2233) ==29944== by 0x838F665: execute_pass_list(opt_pass*) (passes.c:2286) ==29944== by 0x838F678: execute_pass_list(opt_pass*) (passes.c:2287) ==29944== by 0x81C20CE: expand_function(cgraph_node*) (cgraphunit.c:1774) ==29944== by 0x81C3E47: compile() (cgraphunit.c:2006) ==29944== by 0x81C40F9: finalize_compilation_unit() (cgraphunit.c:2329) ==29944== by 0x80E4555: c_write_global_declarations() (c-decl.c:10401) ==29944== Address 0x442c74c is 4 bytes before a block of size 140 alloc'd ==29944== at 0x402A17C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==29944== by 0x86CCB67: xrealloc (xmalloc.c:177) ==29944== by 0x81E8EBB: df_grow_reg_info() (df-scan.c:559) ==29944== by 0x81E90FF: df_scan_alloc(bitmap_head*) (df-scan.c:353) ==29944== by 0x81D9244: rest_of_handle_df_initialize() (df-core.c:718) ==29944== by 0x838F3E8: execute_one_pass(opt_pass*) (passes.c:2233) ==29944== by 0x838F665: execute_pass_list(opt_pass*) (passes.c:2286) ==29944== by 0x838F678: execute_pass_list(opt_pass*) (passes.c:2287) ==29944== by 0x81C20CE: expand_function(cgraph_node*) (cgraphunit.c:1774) ==29944== by 0x81C3E47: compile() (cgraphunit.c:2006) ==29944== by 0x81C40F9: finalize_compilation_unit() (cgraphunit.c:2329) ==29944== by 0x80E4555: c_write_global_declarations() (c-decl.c:10401) ==29944== ==29944== Invalid read of size 4 ==29944== at 0x81E5B21: df_install_ref(df_ref_d*, df_reg_info*, df_ref_info*, bool) (df-scan.c:2575) ==29944== by 0x81E5C7C: df_install_refs(basic_block_def*, vec<df_ref_d*, va_heap, vl_ptr> const*, df_reg_info**, df_ref_info*, bool) [clone .isra.17] (df-scan.c:2656) ==29944== by 0x81E5DCA: df_refs_add_to_chains(df_collection_rec*, basic_block_def*, rtx_def*, unsigned int) (df-scan.c:2715) ==29944== by 0x81EAA4C: df_bb_refs_record(int, bool) (df-scan.c:3643) ==29944== by 0x81EAC62: df_scan_blocks() (df-scan.c:679) ==29944== by 0x81D9323: rest_of_handle_df_initialize() (df-core.c:737) ==29944== by 0x838F3E8: execute_one_pass(opt_pass*) (passes.c:2233) ==29944== by 0x838F665: execute_pass_list(opt_pass*) (passes.c:2286) ==29944== by 0x838F678: execute_pass_list(opt_pass*) (passes.c:2287) ==29944== by 0x81C20CE: expand_function(cgraph_node*) (cgraphunit.c:1774) ==29944== by 0x81C3E47: compile() (cgraphunit.c:2006) ==29944== by 0x81C40F9: finalize_compilation_unit() (cgraphunit.c:2329) ==29944== Address 0x4 is not stack'd, malloc'd or (recently) free'd ==29944== /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. ==29944== ==29944== HEAP SUMMARY: ==29944== in use at exit: 352,939 bytes in 2,272 blocks ==29944== total heap usage: 3,676 allocs, 1,404 frees, 1,124,650 bytes allocated ==29944== ==29944== LEAK SUMMARY: ==29944== definitely lost: 24 bytes in 2 blocks ==29944== indirectly lost: 2,068 bytes in 3 blocks ==29944== possibly lost: 13,053 bytes in 4 blocks ==29944== still reachable: 337,794 bytes in 2,263 blocks ==29944== suppressed: 0 bytes in 0 blocks ==29944== Rerun with --leak-check=full to see details of leaked memory ==29944== ==29944== For counts of detected and suppressed errors, rerun with: -v ==29944== ERROR SUMMARY: 5 errors from 3 contexts (suppressed: 0 from 0) On Mon, Apr 6, 2015 at 2:37 PM, ftwilliam <ftwilliam@xxxxxxxxx> wrote: > 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@xxxxxxxxxx> 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