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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
          Component|c                           |middle-end
      Known to work|                            |10.0, 7.3.0, 8.3.0, 9.1.0
         Resolution|---                         |FIXED
      Known to fail|                            |4.5.2, 4.8.5, 4.9.4, 5.4.0,
                   |                            |6.4.0

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 7 and later diagnose the test case:

pr50476.c: In function ‘main’:
pr50476.c:17:9: warning: ‘y’ is used uninitialized in this function
[-Wuninitialized]
   17 |         printf("int: %d\n", *x);
      |         ^~~~~~~~~~~~~~~~~~~~~~~

The warning is less from ideal because it doesn't point to the y it refers to
but that's a separate issue.

The change that added the warning is r245840 so this can be resolved as fixed.

2017-03-02  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/79345
        PR c++/42000
        * tree-ssa-alias.c (walk_aliased_vdefs_1): Take a limit
        param and abort the walk, returning -1 if it is hit.
        (walk_aliased_vdefs): Take a limit param and pass it on.
        * tree-ssa-alias.h (walk_aliased_vdefs): Add a limit param,
        defaulting to 0 and return a signed int.
        * tree-ssa-uninit.c (struct check_defs_data): New struct.
        (check_defs): New helper.
        (warn_uninitialized_vars): Use walk_aliased_vdefs to warn
        about uninitialized memory.

        * fixed-value.c (fixed_from_string): Use ulow/uhigh to avoid
        bogus uninitialized warning.
        (fixed_convert_from_real): Likewise.

        * g++.dg/warn/Wuninitialized-7.C: New testcase.
        * c-c++-common/ubsan/bounds-2.c: Add -Wno-uninitialized.
        * gcc.dg/uninit-pr19430-2.c: Add expected warning.

Reply via email to