This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] fix for PR 59825


> -----Original Message-----
> From: Jakub Jelinek [mailto:jakub@redhat.com]
> Sent: Wednesday, January 15, 2014 5:55 PM
> To: Iyer, Balaji V
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] fix for PR 59825
> 
> On Wed, Jan 15, 2014 at 10:37:04PM +0000, Iyer, Balaji V wrote:
> > Hello Everyone,
> 
> > Attached, please find a patch that will fix PR 59825.  The main issue
> > was array notations occurring in COMPOUND_EXPR.  This patch should fix
> > that and fix the rank_mismatch2.c test-case ICE.
> 
> > --- a/gcc/c/c-array-notation.c
> > +++ b/gcc/c/c-array-notation.c
> > @@ -1289,6 +1289,15 @@ expand_array_notation_exprs (tree t)
> >  	 A[x:y];
> >  	 Replace those with just void zero node.  */
> >        t = void_zero_node;
> > +      return t;
> > +    case COMPOUND_EXPR:
> > +      if (contains_array_notation_expr (t))
> > +	if (TREE_CODE (TREE_OPERAND (t, 0)) == SAVE_EXPR)
> > +	  {
> > +	    t = expand_array_notation_exprs (TREE_OPERAND (t, 1));
> > +	    return t;
> > +	  }
> > +         /* Else fall through.  */
> >      default:
> >        for (int ii = 0; ii < TREE_CODE_LENGTH (TREE_CODE (t)); ii++)
> >  	if (contains_array_notation_expr (TREE_OPERAND (t, ii)))
> 
> Why doesn't the default case handle it?  Furthermore, you are removing the
> COMPOUND_EXPR and the SAVE_EXPR from the first operand of the
> COMPOUND_EXPR, that reverts the effects of the fix if there are array
> notations anywhere.
> 
> And last comment to the expand_array_notation_exprs, especially the C++
> one, wouldn't it be better to rewrite them as walk_tree/cp_walk_tree
> callbacks, so that it really handles all expressions, not just a small subset of
> them?
> E.g. in C++ you just don't look at all about OMP_PARALLEL etc., so I'd expect
> you ICE if array notation is found inside of #pragma omp parallel body.

Hi Jakub,
	Attached, please find a fixed patch where I rewrote the expand_array_notation_exprs using walk_trees. In this implementation, I am also not reverting the effects of compound or save exprs.  Is this OK for trunk?

Here are the Changelog entries:
+2014-01-20  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+       PR c/59825
+       * c-array-notation.c (expand_array_notation_exprs): Rewrote this
+       function to use walk_tree and moved a lot of its functionality to
+       expand_array_notations.
+       (expand_array_notations): New function.
+

Thanks,

Balaji V. Iyer.

> 
> 	Jakub

Attachment: diff.txt
Description: diff.txt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]