This is the mail archive of the
mailing list for the Cygwin project.
Re: [PATCH] Fix potentially uninitialized variable p
- From: Ray Donnelly <mingw dot android at gmail dot com>
- To: cygwin-patches at cygwin dot com
- Date: Wed, 8 Jan 2014 15:23:57 +0000
- Subject: Re: [PATCH] Fix potentially uninitialized variable p
- Authentication-results: sourceware.org; auth=none
- References: <CAOYw7dvP64FFXUJS60ixUqj2jr01Dzf3YrchyR79m7AQEb8TKA at mail dot gmail dot com> <20131222071118 dot GB2110 at ednor dot casa dot cgf dot cx> <CAOYw7dt68FHWKmaHwQ5bPoOZTODBAhbVFv5UkoiBbY1-kU6kjQ at mail dot gmail dot com> <20140108143814 dot GA4931 at ednor dot casa dot cgf dot cx>
On Wed, Jan 8, 2014 at 2:38 PM, Christopher Faylor wrote:
> On Wed, Jan 08, 2014 at 11:00:14AM +0000, Ray Donnelly wrote:
>>On Sun, Dec 22, 2013 at 7:11 AM, Christopher Faylor wrote:
>>> On Sun, Dec 22, 2013 at 12:40:20AM +0000, Ray Donnelly wrote:
>>>>- PWCHAR p;
>>>>+ PWCHAR p = NULL;
>>> AFAICT, that would result in a NULL dereference. I've checked in
>>> a different change to handle this.
>>A NULL dereference is maybe more consistent than the random
>>dereference that would have otherwise happened.
>>I was only trying to ensure -Werror builds succeed.
> -Werror is the default for Cygwin. This code has been around for a long
> time and the compiler has never complained before. Nevertheless, if the
> compiler found a valid issue, making an invalid change to make it shut
> up is hardly "more consistent".
I meant more consistent from the "data is always zero so it'd be more
deterministically debuggable" perspective rather than what I think you
I was using MSYS2's GCC 4.8.2 with DEBUG defined at -O0, AFAIR.
Do you build debug at -O0? Optimization passes can often remove the
possibility of a variable being uninitialized.
Anyway, thanks for fixing it properly.