[Bug tree-optimization/56854] [4.9 Regression] error: non-decl/MEM_REF LHS in clobber statement

2013-04-09 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56854



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 Status|UNCONFIRMED |RESOLVED

 Resolution||FIXED



--- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-09 
10:16:15 UTC ---

Author: jakub

Date: Tue Apr  9 10:04:24 2013

New Revision: 197625



URL: http://gcc.gnu.org/viewcvs?rev=197625root=gccview=rev

Log:

PR tree-optimization/56854

* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Don't

forward into clobber stmts if it would change MEM_REF lhs into

non-MEM_REF.



* g++.dg/torture/pr56854.C: New test.



Added:

trunk/gcc/testsuite/g++.dg/torture/pr56854.C

Modified:

trunk/gcc/ChangeLog

trunk/gcc/testsuite/ChangeLog

trunk/gcc/tree-ssa-forwprop.c


[Bug tree-optimization/56854] [4.9 Regression] error: non-decl/MEM_REF LHS in clobber statement

2013-04-08 Thread rguenth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56854



Richard Biener rguenth at gcc dot gnu.org changed:



   What|Removed |Added



  Component|c++ |tree-optimization

   Target Milestone|--- |4.9.0

Summary|error: non-decl/MEM_REF LHS |[4.9 Regression] error:

   |in clobber statement|non-decl/MEM_REF LHS in

   ||clobber statement



--- Comment #2 from Richard Biener rguenth at gcc dot gnu.org 2013-04-08 
11:09:28 UTC ---

It's very likely forwprop that does this.  We should probably disallow

any forwprop into CLOBBER lhs.  CCP will do everything that is allowed.


[Bug tree-optimization/56854] [4.9 Regression] error: non-decl/MEM_REF LHS in clobber statement

2013-04-08 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56854



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 CC||jakub at gcc dot gnu.org



--- Comment #3 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-08 
14:15:17 UTC ---

So like this?



Reducing testcase now...



--- tree-ssa-forwprop.c.jj12013-02-25 23:51:21.0 +0100

+++ tree-ssa-forwprop.c2013-04-08 16:12:37.908611768 +0200

@@ -826,7 +826,11 @@ forward_propagate_addr_expr_1 (tree name

 integer_zerop (TREE_OPERAND (lhs, 1))

 useless_type_conversion_p

 (TREE_TYPE (TREE_OPERAND (def_rhs, 0)),

- TREE_TYPE (gimple_assign_rhs1 (use_stmt

+ TREE_TYPE (gimple_assign_rhs1 (use_stmt)))

+   /* Don't forward anything into clobber stmts if it would result

+  in the lhs no longer being a MEM_REF.  */

+(!gimple_clobber_p (use_stmt)

+   || TREE_CODE (TREE_OPERAND (def_rhs, 0)) == MEM_REF))

 {

   tree *def_rhs_basep = TREE_OPERAND (def_rhs, 0);

   tree new_offset, new_base, saved, new_lhs;


[Bug tree-optimization/56854] [4.9 Regression] error: non-decl/MEM_REF LHS in clobber statement

2013-04-08 Thread rguenth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56854



--- Comment #4 from Richard Biener rguenth at gcc dot gnu.org 2013-04-08 
15:03:19 UTC ---

(In reply to comment #3)

 So like this?

 

 Reducing testcase now...

 

 --- tree-ssa-forwprop.c.jj12013-02-25 23:51:21.0 +0100

 +++ tree-ssa-forwprop.c2013-04-08 16:12:37.908611768 +0200

 @@ -826,7 +826,11 @@ forward_propagate_addr_expr_1 (tree name

  integer_zerop (TREE_OPERAND (lhs, 1))

  useless_type_conversion_p

  (TREE_TYPE (TREE_OPERAND (def_rhs, 0)),

 - TREE_TYPE (gimple_assign_rhs1 (use_stmt

 + TREE_TYPE (gimple_assign_rhs1 (use_stmt)))

 +   /* Don't forward anything into clobber stmts if it would result

 +  in the lhs no longer being a MEM_REF.  */

 +(!gimple_clobber_p (use_stmt)

 +   || TREE_CODE (TREE_OPERAND (def_rhs, 0)) == MEM_REF))

  {

tree *def_rhs_basep = TREE_OPERAND (def_rhs, 0);

tree new_offset, new_base, saved, new_lhs;



Yes.