[PATCH] tree-ssa-uninit: suppress more spurious warnings

Jeff Law law@redhat.com
Fri May 17 16:43:00 GMT 2019


On 5/17/19 2:12 AM, Vladislav Ivanishin wrote:
> Hi!
> 
> Without the patch, two of the newly added tests fail with bogus warnings:
> 
> - gcc.dg/uninit-28-gimple.c (Definition guarded with NE_EXPR, use with
>   BIT_AND_EXPR.  This is an FP my previous patch [1] knowingly
>   overlooks.)
> - gcc.dg/uninit-30-gimple.c (EQ_EXPR in the predicate guarding use.
>   This is what I spotted while refactoring.  It never worked, and is
>   easy to handle).
> 
> Bootstraped with `BOOT_CFLAGS="-O -Wno-error=maybe-uninitialized
> -Wuninitialized"` and regtested on x86_64-pc-linux-gnu.  OK for trunk?
> 
> Also, Richard, would you mind being a sponsor for my svn account?
> 
> [1]: https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00896.html
> 
> 
> 0001-tree-ssa-uninit-suppress-more-spurious-warnings.patch
> 
> 	* tree-ssa-uninit.c (value_sat_pred_p): This new function is a wrapper
>         around is_value_included_in that knows how to handle BIT_AND_EXPR.
>         (is_pred_expr_subset_of): Use the new function.  Handle more cases where
>         code1 == EQ_EXPR and where code1 == BIT_AND_EXPR and thus fix some false
>         positives.
> 
> testsuite/
>         * gcc.dg/uninit-28-gimple.c: New test.
>         * gcc.dg/uninit-29-gimple.c: New test.
>         * gcc.dg/uninit-30-gimple.c: New test.
>         * gcc.dg/uninit-31-gimple.c: New test.
So my question is are these showing up in practice?  The gimple based
tests seem to be skipping the optimizers that would have eliminated this
stuff.

In each of the testcases I would have expected jump threading to have
eliminated the problematical path through the CFG.

I'm not philosophically opposed to improving tree-ssa-uninit.c, but I
just want to understand why we're looking at this aspect of it right now.

If you wanted an interesting project to tackle, separating the predicate
analysis done by tree-ssa-uninit.c from using it to prune false positive
-Wuninitialized warnings would be hugely appreciated.  I think there's
value in re-using the predicate analysis elsewhere in GCC.

jeff

ps. You could list me as a sponsor if Richi doesn't respond.



More information about the Gcc-patches mailing list