[Bug tree-optimization/80635] [8/9/10 regression] std::optional and bogus -Wmaybe-uninitialized warning

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 2 20:12:00 GMT 2020


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

--- Comment #48 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #47)
> Martin, yea, your patch does prevent creation of the V_C_E.  That in turn
> allows maybe_a$live_7 to be directly used in the conditional which in turn
> allows tree-ssa-uninit.c to realize the problematic path isn't runtime
> feasible and suppresses the warning.

This should also work too:
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index ea8594db193..83b1d981439 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2499,6 +2499,7 @@ analyze_access_subtree (struct access *root, struct
access *parent,
          For integral types this means the precision has to match.
         Avoid assumptions based on the integral type kind, too.  */
       if (INTEGRAL_TYPE_P (root->type)
+         && TREE_CODE (root->type) != BOOLEAN_TYPE
          && (TREE_CODE (root->type) != INTEGER_TYPE
              || TYPE_PRECISION (root->type) != root->size)
          /* But leave bitfield accesses alone.  */

---- CUT ----


More information about the Gcc-bugs mailing list