---- testcase.c ----
int i;
--------------------
Actually, it seems any C file will suffice to reproduce.

Valgrind output:
$ valgrind -q --trace-children=yes gcc testcase.c -c
==10251== Invalid read of size 8
==10251==    at 0xFEE4F3: search_line_sse2 (lex.c:372)
==10251==    by 0xFEE6E9: _cpp_clean_line (lex.c:649)
==10251==    by 0xFEF0E7: _cpp_get_fresh_line (lex.c:1862)
==10251==    by 0xFF0871: _cpp_lex_direct (lex.c:1927)
==10251==    by 0xFF1666: _cpp_lex_token (lex.c:1801)
==10251==    by 0xFF3DA7: cpp_get_token (macro.c:1240)
==10251==    by 0xFF405F: cpp_get_token_with_location (macro.c:1352)
==10251==    by 0x54977C: c_lex_with_flags (c-lex.c:302)
==10251==    by 0x502FE7: c_lex_one_token (c-parser.c:204)
==10251==    by 0x513367: c_parse_file (c-parser.c:320)
==10251==    by 0x54EE0A: c_common_parse_file (c-opts.c:1206)
==10251==    by 0x8AB1D8: toplev_main (toplev.c:971)
==10251==  Address 0x710b9c8 is 0 bytes after a block of size 8 alloc'd
==10251==    at 0x4C261DF: realloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10251==    by 0x1017B6C: xrealloc (xmalloc.c:179)
==10251==    by 0xFE32BF: _cpp_convert_input (charset.c:1734)
==10251==    by 0xFEBC52: read_file (files.c:648)
==10251==    by 0xFEC67A: _cpp_stack_file (files.c:723)
==10251==    by 0xFEDF60: cpp_read_main_file (init.c:570)
==10251==    by 0x54E4BA: c_common_post_options (c-opts.c:1124)
==10251==    by 0x8AA6D4: toplev_main (toplev.c:1743)
==10251==    by 0x6589BBC: (below main) (in /lib64/libc-2.11.2.so)
==10251== 

Tested revisions:
r163468 - fail
r162940 - OK
r161659 - OK


-- 
           Summary: [4.6 Regression] valgrind reports out-of-bounds read in
                    search_line_sse2
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45386

Reply via email to