git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 16:56 UTC

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

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
May 5, 2026, 00:41 UTC
Message-ID
<aad833e9-d34e-4e57-a1e7-99dc0c6c7d24@ramsayjones.plus.com>
In-Reply-To
<cccf9618-31de-447b-ab17-4fb8cee23363@app.fastmail.com>
On 04/05/2026 10:56 pm, Kristoffer Haugsbakk wrote:
Show 21 quoted lines
> On Mon, May 4, 2026, at 22:26, Ramsay Jones wrote:
>> On 04/05/2026 2:13 am, Junio C Hamano wrote:
>>> Ramsay Jones <ramsay@ramsayjones.plus.com> 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).

Show 6 quoted lines
>     CFLAGS+=-ggdb3
>     USE_ASCIIDOCTOR=true
> 
> I switched to the whole config.mak.dev enchilada and now it fails
> as it should.
> 
Previous: Kristoffer HaugsbakkNext: Kristoffer Haugsbakk
Message 7 of 8 in “name-rev: fix an 'may be used uninitialized' error”
  1. name-rev: fix an 'may be used uninitialized' errorRamsay Jones, May 3, 2026
  2. Kristoffer HaugsbakkMay 3, 2026
  3. Junio C HamanoMay 4, 2026
  4. Kristoffer HaugsbakkMay 4, 2026
  5. Ramsay JonesMay 4, 2026
  6. Kristoffer HaugsbakkMay 4, 2026
  7. Ramsay JonesMay 5, 2026
  8. Kristoffer HaugsbakkMay 5, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.