public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug preprocessor/34869] New: valgrind error indication in testsuite from _cpp_lex_token (lex.c:783) with gcc.dg/cpp/line5.c @ 2008-01-19 12:00 hp at gcc dot gnu dot org 2008-04-18 16:39 ` [Bug preprocessor/34869] " tromey at gcc dot gnu dot org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: hp at gcc dot gnu dot org @ 2008-01-19 12:00 UTC (permalink / raw) To: gcc-bugs A r131535 of trunk (a later revision is recommended, at least >= r131589) bootstrapped with --enable-langugages=c --enable-checking=release,valgrind shows these error indications for gcc.dg/cpp/line5.c (as in gcc.log, but only the first 3 are shown): Executing on host: /tmp/hptest8/obj/gcc/xgcc -B/tmp/hptest8/obj/gcc/ /tmp/hptest8/gcc/gcc/testsuite/gcc.dg/cpp/line5.c -fpreproc essed -fno-show-column -E -o line5.i (timeout = 300) ==24251== Conditional jump or move depends on uninitialised value(s) ==24251== at 0x92D27B: _cpp_lex_token (lex.c:783) ==24251== by 0x92F6FC: cpp_get_token (macro.c:1110) ==24251== by 0x4499B7: preprocess_file (c-ppoutput.c:148) ==24251== by 0x4422C0: c_common_init (c-opts.c:1237) ==24251== by 0x44C21D: c_objc_common_init (c-objc-common.c:72) ==24251== by 0x5F5FA7: toplev_main (toplev.c:2128) ==24251== by 0x387301E073: (below main) (in /lib64/libc-2.7.so) ==24251== ==24251== Conditional jump or move depends on uninitialised value(s) ==24251== at 0x92F712: cpp_get_token (macro.c:1137) ==24251== by 0x4499B7: preprocess_file (c-ppoutput.c:148) ==24251== by 0x4422C0: c_common_init (c-opts.c:1237) ==24251== by 0x44C21D: c_objc_common_init (c-objc-common.c:72) ==24251== by 0x5F5FA7: toplev_main (toplev.c:2128) ==24251== by 0x387301E073: (below main) (in /lib64/libc-2.7.so) ==24251== ==24251== Conditional jump or move depends on uninitialised value(s) ==24251== at 0x4499C2: preprocess_file (c-ppoutput.c:150) ==24251== by 0x4422C0: c_common_init (c-opts.c:1237) ==24251== by 0x44C21D: c_objc_common_init (c-objc-common.c:72) ==24251== by 0x5F5FA7: toplev_main (toplev.c:2128) ==24251== by 0x387301E073: (below main) (in /lib64/libc-2.7.so) -- Summary: valgrind error indication in testsuite from _cpp_lex_token (lex.c:783) with gcc.dg/cpp/line5.c Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hp at gcc dot gnu dot org GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34869 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/34869] valgrind error indication in testsuite from _cpp_lex_token (lex.c:783) with gcc.dg/cpp/line5.c 2008-01-19 12:00 [Bug preprocessor/34869] New: valgrind error indication in testsuite from _cpp_lex_token (lex.c:783) with gcc.dg/cpp/line5.c hp at gcc dot gnu dot org @ 2008-04-18 16:39 ` tromey at gcc dot gnu dot org 2009-04-23 17:10 ` lauras at gcc dot gnu dot org 2010-02-11 20:58 ` jakub at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: tromey at gcc dot gnu dot org @ 2008-04-18 16:39 UTC (permalink / raw) To: gcc-bugs -- tromey at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tromey at gcc dot gnu dot | |org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2008-04-18 16:38:18 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34869 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/34869] valgrind error indication in testsuite from _cpp_lex_token (lex.c:783) with gcc.dg/cpp/line5.c 2008-01-19 12:00 [Bug preprocessor/34869] New: valgrind error indication in testsuite from _cpp_lex_token (lex.c:783) with gcc.dg/cpp/line5.c hp at gcc dot gnu dot org 2008-04-18 16:39 ` [Bug preprocessor/34869] " tromey at gcc dot gnu dot org @ 2009-04-23 17:10 ` lauras at gcc dot gnu dot org 2010-02-11 20:58 ` jakub at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: lauras at gcc dot gnu dot org @ 2009-04-23 17:10 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from lauras at gcc dot gnu dot org 2009-04-23 17:09 ------- It looks like _cpp_lex_direct lexes ahead even if there unused lookahead tokens, which later causes uninitialized tokens as reported by valgrind. I am bootstrapping the patch below which seems to fix the issue. Index: libcpp/lex.c =================================================================== --- libcpp/lex.c (revision 146637) +++ libcpp/lex.c (working copy) @@ -880,8 +880,8 @@ } /* Lex a token into RESULT (external interface). Takes care of issues - like directive handling, token lookahead, multiple include - optimization and skipping. */ + like directive handling, multiple include optimization and + skipping. */ const cpp_token * _cpp_lex_token (cpp_reader *pfile) { @@ -900,13 +900,7 @@ || pfile->cur_token >= pfile->cur_run->limit) abort (); - if (pfile->lookaheads) - { - pfile->lookaheads--; - result = pfile->cur_token++; - } - else - result = _cpp_lex_direct (pfile); + result = _cpp_lex_direct (pfile); if (result->flags & BOL) { @@ -1003,10 +997,11 @@ /* Lex a token into pfile->cur_token, which is also incremented, to get diagnostics pointing to the correct location. - Does not handle issues such as token lookahead, multiple-include - optimization, directives, skipping etc. This function is only - suitable for use by _cpp_lex_token, and in special cases like - lex_expansion_token which doesn't care for any of these issues. + Is able to handle token lookahead, but does not handle issues such + as multiple-include optimization, directives, skipping etc. This + function is only suitable for use by _cpp_lex_token, and in special + cases like lex_expansion_token which doesn't care for any of these + issues. When meeting a newline, returns CPP_EOF if parsing a directive, otherwise returns to the start of the token buffer if permissible. @@ -1019,6 +1014,12 @@ const unsigned char *comment_start; cpp_token *result = pfile->cur_token++; + if (pfile->lookaheads) + { + pfile->lookaheads--; + return result; + } + fresh_line: result->flags = 0; buffer = pfile->buffer; -- lauras at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lauras at gcc dot gnu dot | |org Last reconfirmed|2008-04-18 16:38:18 |2009-04-23 17:09:55 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34869 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/34869] valgrind error indication in testsuite from _cpp_lex_token (lex.c:783) with gcc.dg/cpp/line5.c 2008-01-19 12:00 [Bug preprocessor/34869] New: valgrind error indication in testsuite from _cpp_lex_token (lex.c:783) with gcc.dg/cpp/line5.c hp at gcc dot gnu dot org 2008-04-18 16:39 ` [Bug preprocessor/34869] " tromey at gcc dot gnu dot org 2009-04-23 17:10 ` lauras at gcc dot gnu dot org @ 2010-02-11 20:58 ` jakub at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: jakub at gcc dot gnu dot org @ 2010-02-11 20:58 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from jakub at gcc dot gnu dot org 2010-02-11 20:57 ------- Should be fixed by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156720 on the trunk and http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156721 on the 4.4 branch. -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34869 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-02-11 20:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-01-19 12:00 [Bug preprocessor/34869] New: valgrind error indication in testsuite from _cpp_lex_token (lex.c:783) with gcc.dg/cpp/line5.c hp at gcc dot gnu dot org 2008-04-18 16:39 ` [Bug preprocessor/34869] " tromey at gcc dot gnu dot org 2009-04-23 17:10 ` lauras at gcc dot gnu dot org 2010-02-11 20:58 ` jakub at gcc dot gnu dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).