Bug 69628 - [6 Regression] Conditional jump or move depends on uninitialised value(s) in lex_charconst(cpp_token const*) (c-lex.c:1252)
Summary: [6 Regression] Conditional jump or move depends on uninitialised value(s) in ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-02 14:24 UTC by Martin Liška
Modified: 2016-02-05 19:41 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-02-03 00:00:00


Attachments
gcc6-pr69628.patch (618 bytes, patch)
2016-02-03 12:55 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2016-02-02 14:24:28 UTC
Hello.

Running:
$ echo "0'';" | valgrind --leak-check=yes --trace-children=yes ./gcc/xg++ -Bgcc -std=c++14 -xc++ -

produces:
==14976== Conditional jump or move depends on uninitialised value(s)
==14976==    at 0xB1A59D: lex_charconst(cpp_token const*) (c-lex.c:1252)
==14976==    by 0xB18692: c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int) (c-lex.c:550)
==14976==    by 0x92889A: cp_lexer_get_preprocessor_token(cp_lexer*, cp_token*) (parser.c:792)
==14976==    by 0x928545: cp_lexer_new_main() (parser.c:656)
==14976==    by 0x92BD1A: cp_parser_new() (parser.c:3687)
==14976==    by 0x97B2C0: c_parse_file() (parser.c:37354)
==14976==    by 0xB23FDA: c_common_parse_file() (c-opts.c:1064)
==14976==    by 0x11225EE: compile_file() (toplev.c:465)
==14976==    by 0x1124B96: do_compile() (toplev.c:1988)
==14976==    by 0x1124E21: toplev::main(int, char**) (toplev.c:2096)
==14976==    by 0x1B4DE9F: main (main.c:39)

Thanks,
Martin
Comment 1 Jakub Jelinek 2016-02-03 12:55:35 UTC
Created attachment 37568 [details]
gcc6-pr69628.patch

Untested fix.
Comment 2 Jakub Jelinek 2016-02-05 19:40:20 UTC
Author: jakub
Date: Fri Feb  5 19:39:48 2016
New Revision: 233186

URL: https://gcc.gnu.org/viewcvs?rev=233186&root=gcc&view=rev
Log:
	PR c++/69628
	* charset.c (cpp_interpret_charconst): Clear *PCHARS_SEEN
	and *UNSIGNEDP if bailing out early due to errors.

	* g++.dg/parse/pr69628.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/parse/pr69628.C
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/charset.c
Comment 3 Jakub Jelinek 2016-02-05 19:41:40 UTC
Fixed.