[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nstrftime.c fails to build due to memset overflow

From: Paul Eggert
Subject: Re: nstrftime.c fails to build due to memset overflow
Date: Tue, 14 Mar 2023 14:49:03 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

On 3/14/23 09:50, Pádraig Brady wrote:
The attached also addresses -Wmaybe-initialized warnings in coreutils
that show up at lower optimization levels.

Let's not make that sort of change, please. It makes the code harder to read and analyze, because I look at the code and wonder, "why is this variable being initialized when it doesn't need to be?" And it doesn't insulate the code against the smarter compilers of the future, which I presume will warn us against unnecessary assignments.

If you're going to make that sort of change, at least do what GNU Emacs does:

  /* 'int x UNINIT;' is equivalent to 'int x;', except it cajoles GCC
   into not warning incorrectly about use of an uninitialized variable. */
  #if defined GCC_LINT || defined lint
  # define UNINIT = {0,}
  # define UNINIT /* empty */

and then say "int x UNINIT;" instead of "int x;". But personally I would leave things alone and ask people to use better compiler options that don't generate so many false positives.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]