[patch] Error on setenv(..., NULL, ...)
Paul Pluzhnikov
ppluzhnikov@google.com
Sun Mar 15 22:54:00 GMT 2015
On Fri, Mar 13, 2015 at 10:17 AM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Roland McGrath wrote:
>>
>> I'm a bit surprised the compiler actually figures out
>> that VALLEN cannot be used uninitialized and doesn't emit the warning.
>> But great if so.
>
>
> Yes, GCC got smarter about that sort of thing quite some time ago
Which GCC did you use?
Using gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 (latest "system" gcc on
Ubuntu 14.04), I get:
setenv.c: In function ‘__add_to_environ’:
setenv.c:176:17: error: ‘vallen’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
const size_t varlen = namelen + 1 + vallen;
^
cc1: all warnings being treated as errors
--
Paul Pluzhnikov
More information about the Libc-alpha
mailing list