On Sat May 21 15:19:06 PDT 2016, 9...@9netics.com wrote: > > < char exitsts[2*ERRMAX]; > > --- > >> Waitmsg *exitsts = nil; > > > > is likely to generate used-and-not-set on amd64. > > > > - erik > > i'm not sure i understand how. can you explain?
since the only code path that uses exitsts sets it unconditionally, setting a declaration time is going to be optimized out. when the optimizer elides setting of a variable it emits the set and not used diagnostic. gcc doesn't do this with the usual flags, which is why it may be unexpected. i've included a test program that makes this a little easier to read. the test program emits the diagnostic "warning: warn.c:9 set and not used: s" - erik --- #include <u.h> #include <libc.h> void main(void) { char *s; s = nil; s = "xyz"; print("s=%s\n", s); exits(""); }