[Bug middle-end/41953] missing uninitialized warning (SRA,VOP)

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 2 07:27:00 GMT 2017


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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Sth like the following.  Note that fentry_reached just means that there
exists a path from function entry to the use that has the use not
initialized -- it doesn't mean this path can be ever executed (there's
no predicate analysis done to disprove the obvious cases).  With restricting
it to uses that are not predicated the amount of false positives should be
minimal (well, hopefully - eventually we need to restrict this to -O1+
for this reason).  Or finally re-write uninit predicate analysis.

Index: gcc/tree-ssa-uninit.c
===================================================================
--- gcc/tree-ssa-uninit.c       (revision 247368)
+++ gcc/tree-ssa-uninit.c       (working copy)
@@ -319,7 +319,8 @@ warn_uninitialized_vars (bool warn_possi
                  continue;
                }
              oracle_cnt += res;
-             if (data.found_may_defs)
+             if (data.found_may_defs
+                 && ! (fentry_reached && always_executed))
                continue;
              /* Do not warn if it can be initialized outside this function.
                 If we did not reach function entry then we found killing
@@ -337,7 +338,7 @@ warn_uninitialized_vars (bool warn_possi
              location_t location
                = linemap_resolve_location (line_table, gimple_location (stmt),
                                            LRK_SPELLING_LOCATION, NULL);
-             if (always_executed)
+             if (always_executed && ! data.found_may_defs)
                {
                  if (warning_at (location, OPT_Wuninitialized,
                                  "%qE is used uninitialized in this function",


More information about the Gcc-bugs mailing list