[PATCH] Fix potentially uninitialized variable p

Ray Donnelly mingw.android@gmail.com
Wed Jan 8 15:24:00 GMT 2014

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
are implying.

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.

> cgf

More information about the Cygwin-patches mailing list