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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic,
                   |                            |missed-optimization
             Status|NEW                         |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
          Component|c                           |middle-end
         Resolution|---                         |DUPLICATE

--- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> ---
With the patch for pr83859 applied
(https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01690.html) GCC diagnoses the
uninitialized access in the test case from comment #1:

$ cat pr31893.c && gcc -S -Wall pr31893.c
struct foo { int toto; };

__attribute__ ((read_only)) void do_bar(const struct foo *);

int main(void) {
    struct foo foo;
    do_bar(&foo);
    return 0;
}
pr31893.c: In function ‘main’:
pr31893.c:7:5: warning: ‘foo’ is used uninitialized in this function
[-Wuninitialized]
    7 |     do_bar(&foo);
      |     ^~~~~~~~~~~~

I'm going to resolve this request as a duplicate of pr83859.

*** This bug has been marked as a duplicate of bug 83859 ***

Reply via email to