[tree-ssa] Fix PR 14470

Diego Novillo dnovillo@redhat.com
Tue Apr 20 16:31:00 GMT 2004


On Thu, 2004-04-15 at 16:05, Jason Merrill wrote:

> The min-lval approach is directly dealing with the actual problem, namely
> an lvalue expression which may change which object it refers to.  The array
> index approach deals with one instance of the problem, and causes
> unnecessary modification of array refs which don't have this problem.
> 
OK.  I've got a problem with it, though.  With this patch we miscompile
something in libstdc++ that causes name mangling problems and we get new
failures.  It also miscompiles gfortran and prevents us from building
libgfortran.

I've spent a few hours trying to pinpoint the problem but can't seem to
find it.  Do you see anything obviously wrong or wonky in the patch?

Thanks.  Diego.

Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gimplify.c,v
retrieving revision 1.1.2.148
diff -d -c -p -r1.1.2.148 gimplify.c
*** gimplify.c	8 Apr 2004 02:42:25 -0000	1.1.2.148
--- gimplify.c	20 Apr 2004 16:05:54 -0000
*************** gimplify_self_mod_expr (tree *expr_p, tr
*** 1821,1829 ****
    else
      arith_code = MINUS_EXPR;
  
!   /* Gimplify the LHS into a GIMPLE lvalue.  */
    lvalue = TREE_OPERAND (*expr_p, 0);
!   ret = gimplify_expr (&lvalue, pre_p, post_p, is_gimple_lvalue, fb_lvalue);
    if (ret == GS_ERROR)
      return ret;
  
--- 1829,1844 ----
    else
      arith_code = MINUS_EXPR;
  
!   /* Gimplify the LHS into a GIMPLE lvalue.  For postfix
!      modifications, request a minimal lvalue so that any references
!      inside LHS are done before the modification.  This prevents the
!      problem exposed in gcc.c-torture/execute/20040313-1.c, where
!      'd = t[d]++' was gimplified such that the assignment to 'd' was
!      emitted before the reference to 't[d]'.  */
    lvalue = TREE_OPERAND (*expr_p, 0);
!   ret = gimplify_expr (&lvalue, pre_p, post_p,
! 		       (postfix) ? is_gimple_min_lval : is_gimple_lvalue,
! 		       fb_lvalue);
    if (ret == GS_ERROR)
      return ret;
  




More information about the Gcc-patches mailing list