http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48762
Summary: valgrind: Invalid read/write of size 8 in cse_main with -O --param max-cse-path-length=0 on basic code Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: zso...@seznam.cz Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu ----- testcase.c ----- void foo (void) {}; ---------------------- Compiler output (under valgrind): $ cc1 -O --param max-cse-path-length=0 testcase.c -quiet ==7641== Invalid read of size 8 ==7641== at 0x10F8710: search_line_sse2 (lex.c:394) ==7641== by 0x10F88B9: _cpp_clean_line (lex.c:665) ==7641== by 0x10F9297: _cpp_get_fresh_line (lex.c:1886) ==7641== by 0x10FAA50: _cpp_lex_direct (lex.c:1951) ==7641== by 0x10FB836: _cpp_lex_token (lex.c:1825) ==7641== by 0x10FE0BF: cpp_get_token (macro.c:1239) ==7641== by 0x10FE21F: cpp_get_token_with_location (macro.c:1351) ==7641== by 0x56ABA2: c_lex_with_flags (c-lex.c:302) ==7641== by 0x521983: c_lex_one_token (c-parser.c:216) ==7641== by 0x534237: c_parse_file (c-parser.c:398) ==7641== by 0x570274: c_common_parse_file (c-opts.c:1092) ==7641== by 0x9002EB: toplev_main (toplev.c:579) ==7641== Address 0x7231680 is 16 bytes inside a block of size 21 alloc'd ==7641== at 0x4C29504: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7641== by 0x1121D9C: xrealloc (xmalloc.c:179) ==7641== by 0x10ED063: _cpp_convert_input (charset.c:1734) ==7641== by 0x10F5F52: read_file (files.c:648) ==7641== by 0x10F68FA: _cpp_stack_file (files.c:723) ==7641== by 0x10F8135: cpp_read_main_file (init.c:570) ==7641== by 0x56F92A: c_common_post_options (c-opts.c:1031) ==7641== by 0x8FFCF6: toplev_main (toplev.c:1283) ==7641== by 0x644AB6C: (below main) (in /lib64/libc-2.11.3.so) ==7641== ==7641== Invalid write of size 8 ==7641== at 0x101CE2E: cse_main (cse.c:6118) ==7641== by 0x101E05D: rest_of_handle_cse (cse.c:7380) ==7641== by 0x8132C5: execute_one_pass (passes.c:1555) ==7641== by 0x8135A4: execute_pass_list (passes.c:1610) ==7641== by 0x8135B6: execute_pass_list (passes.c:1611) ==7641== by 0x95B4AA: tree_rest_of_compilation (tree-optimize.c:423) ==7641== by 0xB3E632: cgraph_expand_function (cgraphunit.c:1576) ==7641== by 0xB40B4B: cgraph_optimize (cgraphunit.c:1635) ==7641== by 0xB410D9: cgraph_finalize_compilation_unit (cgraphunit.c:1096) ==7641== by 0x4F9623: c_write_global_declarations (c-decl.c:9883) ==7641== by 0x900327: toplev_main (toplev.c:591) ==7641== by 0x644AB6C: (below main) (in /lib64/libc-2.11.3.so) ==7641== Address 0x7527030 is 0 bytes inside a block of size 1 alloc'd ==7641== at 0x4C26F30: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7641== by 0x1121D07: xmalloc (xmalloc.c:147) ==7641== by 0x101CC54: cse_main (cse.c:6473) ==7641== by 0x101E05D: rest_of_handle_cse (cse.c:7380) ==7641== by 0x8132C5: execute_one_pass (passes.c:1555) ==7641== by 0x8135A4: execute_pass_list (passes.c:1610) ==7641== by 0x8135B6: execute_pass_list (passes.c:1611) ==7641== by 0x95B4AA: tree_rest_of_compilation (tree-optimize.c:423) ==7641== by 0xB3E632: cgraph_expand_function (cgraphunit.c:1576) ==7641== by 0xB40B4B: cgraph_optimize (cgraphunit.c:1635) ==7641== by 0xB410D9: cgraph_finalize_compilation_unit (cgraphunit.c:1096) ==7641== by 0x4F9623: c_write_global_declarations (c-decl.c:9883) ==7641== ==7641== Invalid read of size 8 ==7641== at 0x101D218: cse_main (cse.c:6266) ==7641== by 0x101E05D: rest_of_handle_cse (cse.c:7380) ==7641== by 0x8132C5: execute_one_pass (passes.c:1555) ==7641== by 0x8135A4: execute_pass_list (passes.c:1610) ==7641== by 0x8135B6: execute_pass_list (passes.c:1611) ==7641== by 0x95B4AA: tree_rest_of_compilation (tree-optimize.c:423) ==7641== by 0xB3E632: cgraph_expand_function (cgraphunit.c:1576) ==7641== by 0xB40B4B: cgraph_optimize (cgraphunit.c:1635) ==7641== by 0xB410D9: cgraph_finalize_compilation_unit (cgraphunit.c:1096) ==7641== by 0x4F9623: c_write_global_declarations (c-decl.c:9883) ==7641== by 0x900327: toplev_main (toplev.c:591) ==7641== by 0x644AB6C: (below main) (in /lib64/libc-2.11.3.so) ==7641== Address 0x7527030 is 0 bytes inside a block of size 1 alloc'd ==7641== at 0x4C26F30: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7641== by 0x1121D07: xmalloc (xmalloc.c:147) ==7641== by 0x101CC54: cse_main (cse.c:6473) ==7641== by 0x101E05D: rest_of_handle_cse (cse.c:7380) ==7641== by 0x8132C5: execute_one_pass (passes.c:1555) ==7641== by 0x8135A4: execute_pass_list (passes.c:1610) ==7641== by 0x8135B6: execute_pass_list (passes.c:1611) ==7641== by 0x95B4AA: tree_rest_of_compilation (tree-optimize.c:423) ==7641== by 0xB3E632: cgraph_expand_function (cgraphunit.c:1576) ==7641== by 0xB40B4B: cgraph_optimize (cgraphunit.c:1635) ==7641== by 0xB410D9: cgraph_finalize_compilation_unit (cgraphunit.c:1096) ==7641== by 0x4F9623: c_write_global_declarations (c-decl.c:9883) ==7641== ==7641== Invalid read of size 8 ==7641== at 0x101D0AD: cse_main (cse.c:6106) ==7641== by 0x101E05D: rest_of_handle_cse (cse.c:7380) ==7641== by 0x8132C5: execute_one_pass (passes.c:1555) ==7641== by 0x8135A4: execute_pass_list (passes.c:1610) ==7641== by 0x8135B6: execute_pass_list (passes.c:1611) ==7641== by 0x95B4AA: tree_rest_of_compilation (tree-optimize.c:423) ==7641== by 0xB3E632: cgraph_expand_function (cgraphunit.c:1576) ==7641== by 0xB40B4B: cgraph_optimize (cgraphunit.c:1635) ==7641== by 0xB410D9: cgraph_finalize_compilation_unit (cgraphunit.c:1096) ==7641== by 0x4F9623: c_write_global_declarations (c-decl.c:9883) ==7641== by 0x900327: toplev_main (toplev.c:591) ==7641== by 0x644AB6C: (below main) (in /lib64/libc-2.11.3.so) ==7641== Address 0x7527030 is 0 bytes inside a block of size 1 alloc'd ==7641== at 0x4C26F30: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7641== by 0x1121D07: xmalloc (xmalloc.c:147) ==7641== by 0x101CC54: cse_main (cse.c:6473) ==7641== by 0x101E05D: rest_of_handle_cse (cse.c:7380) ==7641== by 0x8132C5: execute_one_pass (passes.c:1555) ==7641== by 0x8135A4: execute_pass_list (passes.c:1610) ==7641== by 0x8135B6: execute_pass_list (passes.c:1611) ==7641== by 0x95B4AA: tree_rest_of_compilation (tree-optimize.c:423) ==7641== by 0xB3E632: cgraph_expand_function (cgraphunit.c:1576) ==7641== by 0xB40B4B: cgraph_optimize (cgraphunit.c:1635) ==7641== by 0xB410D9: cgraph_finalize_compilation_unit (cgraphunit.c:1096) ==7641== by 0x4F9623: c_write_global_declarations (c-decl.c:9883) ==7641== Tested revisions: r172929 - fail 4.6 r172337 - fail 4.5 r172337 - fail 4.4 r172337 - fail