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

            Bug ID: 90541
           Summary: Warning not emitted on use of uninitialized variable
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wingo at igalia dot com
  Target Milestone: ---

$ gcc --version
gcc (GCC) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat /tmp/foo.c
#include <stdint.h>

uint16_t read_short(void) {
  uint16_t *loc = (uint16_t*)loc;
  return loc[0];
}

$ gcc -Wall -o /tmp/foo.o -c /tmp/foo.c



I would have expected that "uint16_t *loc = (uint16_t*)loc" issues an
uninitialized variable warning, but no warning is emitted.

Reply via email to