This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/69726] [6 Regression] Bogus warnings with -O3 -Wuninitialized because dead code after if-conversion


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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It solved itself with

2016-02-08  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/69719
        * tree-vect-data-refs.c (vect_prune_runtime_alias_test_list):
        Properly use absolute of the difference of the two offsets to
        compare or adjust the segment length.

and no longer vectorizing (too many versioning for alias checks - another
missed optimization).

The following patch would have avoided the warning:

Index: gcc/tree-ssa-uninit.c
===================================================================
--- gcc/tree-ssa-uninit.c       (revision 233239)
+++ gcc/tree-ssa-uninit.c       (working copy)
@@ -231,6 +231,24 @@ warn_uninitialized_vars (bool warn_possi
                  || is_global_var (base))
                continue;

+             /* Do not confuse ourselves with dead code.  See PR69726.  */
+             bool dont_warn = false;
+             gimple *use_stmt = stmt;
+             use_operand_p use_p;
+             tree lhs;
+             do
+               {
+                 lhs = gimple_assign_lhs (use_stmt);
+                 if (TREE_CODE (lhs) != SSA_NAME)
+                   break;
+                 if (has_zero_uses (lhs))
+                   {
+                     dont_warn = true;
+                     continue;
+                   }
+               }
+             while (single_imm_use (lhs, &use_p, &use_stmt));
+
              if (always_executed)
                warn_uninit (OPT_Wuninitialized, use,
                             gimple_assign_rhs1 (stmt), base,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]