Paul Eggert wrote:
> > It is not spam. It is fully justified, since in
> >putenv ((char []) {"TEST_VAR=abc"})
> > the argument is allocated in automatic storage. See ISO C § 6.5.2.5.(12).
>
> Well, to be fair, the test program removed the string from the
> environment before 'main' returned
On 2024-05-24 03:55, Bruno Haible wrote:
It is not spam. It is fully justified, since in
putenv ((char []) {"TEST_VAR=abc"})
the argument is allocated in automatic storage. See ISO C § 6.5.2.5.(12).
Well, to be fair, the test program removed the string from the
environment before 'main' ret
On 5/24/24 3:55 AM, Bruno Haible wrote:
>> I think this change may have uncovered a GCC bug? I noticed lots of
>> -Wanalyzer-putenv-of-auto-var spam in testdirs.
>
> It is not spam. It is fully justified, since in
> putenv ((char []) {"TEST_VAR=abc"})
> the argument is allocated in automatic sto
Collin Funk wrote:
> The putenv
> function places the pointer that it is given into the environment.
> When it goes out of scope the behavior is undefined [1].
Yes. Practically this means that the code in the exit() function
(which gets executed after main() returns) may call getenv(), and
this ca
Hi Paul,
On 5/16/24 10:42 PM, Paul Eggert wrote:
> diff --git a/tests/test-putenv.c b/tests/test-putenv.c
> index 1768e7563a..564c86713a 100644
> --- a/tests/test-putenv.c
> +++ b/tests/test-putenv.c
> @@ -39,7 +39,7 @@ main (void)
>
>/* Verify adding an environment variable. */
>{
> -