Subject: Re: [PATCH] name-rev: fix an 'may be used uninitialized' error

From: Ramsay Jones <[email-masked]>
Date: Tue, 5 May 2026 01:41:45 +0100

On 04/05/2026 10:56 pm, Kristoffer Haugsbakk wrote:
> On Mon, May 4, 2026, at 22:26, Ramsay Jones wrote:
>> On 04/05/2026 2:13 am, Junio C Hamano wrote:
>>> Ramsay Jones <[email-masked]> writes:
>>>> [snip]
>>
>> Having now spent some time (well at least 30 seconds :) ) looking at the
>> surrounding code, then your final suggestion looks really good to me! ;)
>>
>> However, these 'maybe-uninitialized' errors (historically have been) somewhat
>> sensitive to the level of optimization used in the compilation and even algo
>> used by the compiler changing frequently from one version to the next ...
>> So, I wasn't sure if Kristoffer was actually seeing the error or had the
>> DEVELOPER variable set (which is why I mentioned it in passing!).
> 
> This is what I had when maybe-uninit. didn’t fail for me.
> 
>     $ cat config.mak
>     DEVELOPER=1
>     DEBUG=1
>     CC = ccache gcc
>     CFLAGS+=-O0

Ah, yes -O0 will disable the warning/error. Normally CFLAGS would be set to
something like 'CFLAGS = -g -O2 -Wall'. (which still produces a binary you
can reasonably use with gdb).

>     CFLAGS+=-ggdb3
>     USE_ASCIIDOCTOR=true
> 
> I switched to the whole config.mak.dev enchilada and now it fails
> as it should.
>