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 storage. See ISO C § 6.5.2.5.(12).
I meant spam as in lots of output that wasn't there previously. Not
that the warning was incorrect. Apologies for the poor wording. :)
> static char *var = "TEST_VAR=abc";
>
> depending on the warning options enabled. Namely, it warns when
> -Wwrite-strings is enabled:
>
> warning: initialization discards ‘const’ qualifier from pointer target type
> [-Wdiscarded-qualifiers]
[...]
> No. The analyzer's warning is only about strings with limited lifetime,
> it is not about strings that are not writable. That is a different
> category of warnings.
Thanks for the explanation. I understand after looking at your
previous commit.
Unless I'm compiling something that uses '--enable-gcc-warnings' or
similar, I just copy the warnings from HACKING. In there the following
is listed:
$ WARN_CFLAGS_GCC13="$WARN_GCC13 -Wnested-externs -Wshadow=local
-Wno-discarded-qualifiers"
Which explains why I didn't see the -Wdiscarded-qualifiers when
writing that test.
Collin