On Thu, Nov 13, 2014 at 06:20:16AM -0800, Teresa Johnson wrote:
> Here is the new patch. Bootstrapped and tested on
> x86_64-unknown-linux-gnu. OK for trunk?
>
> Thanks,
> Teresa
>
> 2014-11-13 <[email protected]>
>
> gcc:
> PR tree-optimization/63841
> * tree.c (initializer_zerop): A constructor with no elements
> does not zero initialize.
>
> gcc/testsuite:
> PR tree-optimization/63841
> * g++.dg/tree-ssa/pr63841.C: New test.
>
> Index: tree.c
> ===================================================================
> --- tree.c (revision 217190)
> +++ tree.c (working copy)
> @@ -10330,6 +10330,8 @@ initializer_zerop (const_tree init)
> {
> unsigned HOST_WIDE_INT idx;
>
> + if (TREE_CLOBBER_P (init))
> + return false;
Wrong formatting.
Also, while this perhaps is useful, I'd say the right fix is that
strlen_optimize_stmt
should just ignore gimple_clobber_p (stmt) statements (well, call
the maybe_invalidate at the end for them).
So
- else if (is_gimple_assign (stmt))
+ else if (is_gimple_assign (stmt) && !gimple_clobber_p (stmt))
in strlen_optimize_stmt.
Jakub