------- Comment #14 from hjl dot tools at gmail dot com 2010-09-02 13:52 ------- On Linux/x86, -fPIC triggered invalid memory access:
[...@gnu-6 gcc]$ valgrind --tool=memcheck ./cc1 -fpreprocessed /tmp/sprintf-chk.i -quiet -dumpbase sprintf-chk.i -m32 -mtune=generic -march=x86-64 -auxbase sprintf-chk -Os -w -version -fpic -o sprintf-chk.s ==8036== Memcheck, a memory error detector ==8036== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==8036== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info ==8036== Command: ./cc1 -fpreprocessed /tmp/sprintf-chk.i -quiet -dumpbase sprintf-chk.i -m32 -mtune=generic -march=x86-64 -auxbase sprintf-chk -Os -w -version -fpic -o sprintf-chk.s ==8036== GNU C (GCC) version 4.6.0 20100901 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.4.4 20100630 (Red Hat 4.4.4-10), GMP version 4.3.2, MPFR version 2.4.2-p3, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C (GCC) version 4.6.0 20100901 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.4.4 20100630 (Red Hat 4.4.4-10), GMP version 4.3.2, MPFR version 2.4.2-p3, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 5013623740daff515d54e379ca68fe2e ==8036== Invalid read of size 8 ==8036== at 0x67F8A2: dwarf2out_notice_stack_adjust (dwarf2out.c:1624) ==8036== by 0x681BD7: dwarf2out_frame_debug (dwarf2out.c:2744) ==8036== by 0xCC2DD1: output_set_got (i386.c:8127) ==8036== by 0xEACFD2: output_615 (i386.md:11477) ==8036== by 0x719262: get_insn_template (final.c:1731) ==8036== by 0x71A9C7: final_scan_insn (final.c:2609) ==8036== by 0x719178: final (final.c:1716) ==8036== by 0x71D885: rest_of_handle_final (final.c:4235) ==8036== by 0x8F68AA: execute_one_pass (passes.c:1568) ==8036== by 0x8F6A99: execute_pass_list (passes.c:1623) ==8036== by 0x8F6ABA: execute_pass_list (passes.c:1624) ==8036== by 0x8F6ABA: execute_pass_list (passes.c:1624) ==8036== Address 0xb8ee848 is 0 bytes after a block of size 2,472 alloc'd ==8036== at 0x4A0515D: malloc (vg_replace_malloc.c:195) ==8036== by 0x1118BB3: xmalloc (xmalloc.c:147) ==8036== by 0x67EFA1: compute_barrier_args_size (dwarf2out.c:1429) ==8036== by 0x67F873: dwarf2out_notice_stack_adjust (dwarf2out.c:1619) ==8036== by 0x681BD7: dwarf2out_frame_debug (dwarf2out.c:2744) ==8036== by 0x719E79: final_scan_insn (final.c:2015) ==8036== by 0x719178: final (final.c:1716) ==8036== by 0x71D885: rest_of_handle_final (final.c:4235) ==8036== by 0x8F68AA: execute_one_pass (passes.c:1568) ==8036== by 0x8F6A99: execute_pass_list (passes.c:1623) ==8036== by 0x8F6ABA: execute_pass_list (passes.c:1624) ==8036== by 0x8F6ABA: execute_pass_list (passes.c:1624) ==8036== ==8036== ==8036== HEAP SUMMARY: ==8036== in use at exit: 432,089 bytes in 1,754 blocks ==8036== total heap usage: 15,425 allocs, 13,671 frees, 7,502,579 bytes allocated ==8036== ==8036== LEAK SUMMARY: ==8036== definitely lost: 0 bytes in 0 blocks ==8036== indirectly lost: 0 bytes in 0 blocks ==8036== possibly lost: 16,064 bytes in 2 blocks ==8036== still reachable: 416,025 bytes in 1,752 blocks ==8036== suppressed: 0 bytes in 0 blocks ==8036== Rerun with --leak-check=full to see details of leaked memory ==8036== ==8036== For counts of detected and suppressed errors, rerun with: -v ==8036== ERROR SUMMARY: 5 errors from 1 contexts (suppressed: 6 from 6) [...@gnu-6 gcc]$ -- hjl dot tools at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ubizjak at gmail dot com GCC build triplet|x86_64-apple-darwin10 | GCC host triplet|x86_64-apple-darwin10 | GCC target triplet|x86_64-apple-darwin10 | Summary|r163660 ICEs gcc.c- |Invalid memory access in |torture/execute/builtins/spr|gcc.c- |intf-chk.c compilation, -Os|torture/execute/builtins/spr |at -m32 |intf-chk.c Target Milestone|--- |4.6.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45484