https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81897

--- Comment #16 from Arnd Bergmann <arnd at linaro dot org> ---
Created attachment 43056
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43056&action=edit
linux/net/ipv6/route.c, preprocessed and compressed

To test the patch, I reverted the workaround that was added to the kernel when
I originally reported this. Unfortunately the warning is still there, only the
reduced version is fixed. I attached the preprocessed source now, test with

$ x86_64-linux-gcc-8.0.0 -fno-strict-aliasing -Wall -O2 -Wno-pointer-sign -c
route-1.i
/git/arm-soc/net/ipv6/route.c: In function 'inet6_rtm_getroute':
/git/arm-soc/net/ipv6/route.c:4350:9: warning: 'dst' may be used uninitialized
in this function [-Wmaybe-uninitialized]
   goto errout;
         ^~~~~~
  }

Reducing this with the latest gcc-8.0.0 snapshot gave me

enum { true } fn1();
int inet6_rtm_getroute_iif, inet6_rtm_getroute_rt, inet6_rtm_getroute_rtm_0;
int *inet6_rtm_getroute___trans_tmp_8;
int fn2();
void fn3() {
  int *dst;
  _Bool fibmatch = inet6_rtm_getroute_rtm_0 & 2;
  if (inet6_rtm_getroute_iif) {
    if (!fibmatch)
      dst = inet6_rtm_getroute___trans_tmp_8;
    static _Bool __warned;
    fn2() && __warned &&fn1();
    __warned = true;
  } else if (!fibmatch)
    dst = 0;
  if (fibmatch)
    dst = 0;
  inet6_rtm_getroute_rt = *dst;
}

Reply via email to