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



Martin Jambor <jamborm at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |jamborm at gcc dot gnu.org



--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> 2013-01-11 
16:53:08 UTC ---

As far as the ICE is concerned, I think that if we want to fix it by

reverting patches, we need to revert both the patch for PR 55579 and

PR 54971 (which introduced the generation of the debug statement in

question).



Alternatively, we can punt and put NULL on the right side of the debug

statement when types do not match.  I looked at all places where SRA

generates them and only in sra_modify_assign we can have this problem.

Yes, in 4.9 we can even create a well-typed MEM_REF.  Meanwhile, the

minimal patch (that I am about to bootstrap and test) would be:





2013-01-11  Martin Jambor  <mjam...@suse.cz>



    PR tree-optimization/55920

    * tree-sra.c (sra_modify_assign): Put NULL RHS into debug statement if

    it would have incompatible types.



Index: src/gcc/tree-sra.c

===================================================================

--- src.orig/gcc/tree-sra.c

+++ src/gcc/tree-sra.c

@@ -3108,8 +3108,15 @@ sra_modify_assign (gimple *stmt, gimple_



   if (lacc && lacc->grp_to_be_debug_replaced)

     {

-      gimple ds = gimple_build_debug_bind (get_access_replacement (lacc),

-                       unshare_expr (rhs), *stmt);

+      tree dbg_rhs;

+      gimple ds;

+

+      if (useless_type_conversion_p (lacc->type, TREE_TYPE (rhs)))

+    dbg_rhs = unshare_expr (rhs);

+      else

+    dbg_rhs = NULL_TREE;

+      ds = gimple_build_debug_bind (get_access_replacement (lacc), dbg_rhs,

+                    *stmt);

       gsi_insert_before (gsi, ds, GSI_SAME_STMT);

     }

Reply via email to