Bug 45386 - [4.6 Regression] valgrind reports out-of-bounds read in search_line_sse2
Summary: [4.6 Regression] valgrind reports out-of-bounds read in search_line_sse2
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 4.6.0
: P3 minor
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 67292 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-23 18:01 UTC by Zdenek Sojka
Modified: 2015-08-20 16:27 UTC (History)
5 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-08-23 18:01:33 UTC
---- 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
Comment 1 Richard Biener 2010-08-23 20:05:36 UTC
I think that's by design (it won't cross page boundary though).
Comment 2 Tom Tromey 2010-09-29 14:36:56 UTC
I agree, that is what is happening here.
I think this is invalid, so I am closing it.
Comment 3 Andrew Pinski 2015-08-20 15:56:38 UTC
*** Bug 67292 has been marked as a duplicate of this bug. ***
Comment 4 Manuel López-Ibáñez 2015-08-20 16:27:01 UTC
It should be possible to create a suppression file to silence false positives:
http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress

but a comment in the code search_line_sse2 (lex.c:372) is probably as good to avoid further duplicates.