This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]