This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C front-end: fix PR c/34867 (valgrind error indication in testsuite from c-lex.c:996:c_lex_with_flags for gcc.dg/cpp/charconst.c)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Laurynas Biveinis <laurynas dot biveinis at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Jun 2008 10:57:31 +0000 (UTC)
- Subject: Re: [PATCH] C front-end: fix PR c/34867 (valgrind error indication in testsuite from c-lex.c:996:c_lex_with_flags for gcc.dg/cpp/charconst.c)
- References: <d1e3ff2b0806232142k2308b96fw59a7460b57c4619a@mail.gmail.com>
On Tue, 24 Jun 2008, Laurynas Biveinis wrote:
> Another little patch in the valgrind on testsuite series.
>
> To set unsignedp value, lex_charconst calls cpp_interpret_charconst.
> Here it quits early with an error, leaving unsignedp uninitialized.
> Fixed by checking error code and initializing unsignedp.
> Bootstrapped/regtested x86_64-unknown-linux-gnu. OK for trunk?
0 is not just an error return here, as far as I can tell it can also be a
valid return value in a non-error case. It just so happens that the value
of unsignedp doesn't matter if the return is 0, because it's only used in
"unsignedp || (cppchar_signed_t) result >= 0". I think it would be better
just to initialize unsignedp when declared (unconditionally), before
calling cpp_interpret_charconst.
--
Joseph S. Myers
joseph@codesourcery.com