bug-gnulib
[Top][All Lists]
Advanced

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

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


From: Bruno Haible
Subject: Re: nstrftime.c fails to build due to memset overflow
Date: Thu, 18 May 2023 23:27:37 +0200

In order to silence these warnings:

> * -O1, -O2, -O3, -Os only:
> ../../gllib/vasnprintf.c:1392:10: warning: 'e' may be used uninitialized 
> [-Wmaybe-uninitialized]
> ../../gllib/vasnprintf.c:1410:10: warning: 'e' may be used uninitialized 
> [-Wmaybe-uninitialized]
> 
> * -Og only:
> ../../gllib/bitset/list.c:458:22: warning: 'tmp' may be used uninitialized 
> [-Wmaybe-uninitialized]

I'm applying small code changes.

- In vasnprintf.c, gcc is right that the variable e is used unitialized; the
  value is passed to a function that then ignores it.
- In bitset/list.c, gcc is fooled by a loop entry test that can never fail,
  but gcc happens to not notice it. As an optimization of the code, let me
  remove this loop entry test (i.e. transform it to a loop end test).


2023-05-18  Bruno Haible  <bruno@clisp.org>

        vasnprintf, c-vasnprintf: Silence gcc warnings.
        * lib/vasnprintf.c (scale10_round_decimal_decoded): Remove memory==NULL
        test.
        (scale10_round_decimal_long_double, scale10_round_decimal_double): Test
        for memory==NULL here. Remove use of IF_LINT.

2023-05-18  Bruno Haible  <bruno@clisp.org>

        bitset: Silence gcc warning.
        * lib/bitset/list.c (lbitset_copy_): Remove redundant test from the
        loop's first iteration.

Attachment: 0001-bitset-Silence-gcc-warning.patch
Description: Text Data

Attachment: 0002-vasnprintf-c-vasnprintf-Silence-gcc-warnings.patch
Description: Text Data


reply via email to

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