This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [RFH]: too many trees in the forest
On Sat, Jul 25, 2009 at 06:00:27PM +0100, Paul Richard Thomas wrote:
> Hi Steve,
>
> Your non-expert advises the following:
>
> > I've added
> >
> > ? ? ? ?/* SOURCE block. ?*/
> > ? ? ? ?if (code->expr3)
> > ? ? ? ? ?{
> > ? ? ? ? ? ?gfc_init_se (&src, NULL);
> > ? ? ? ? ? ?gfc_conv_expr (&src, code->expr3); /*sgk*/
> > ? ? ? ? ? ?gfc_add_expr_to_block (&block, tmp);
> > ? ? ? ? ?}
> >
> > which converts the gfc_expr code->expr3 to a gfc_se. ?In scanning
> > through the trans-*c files, I can't find any function that assigns
> > src to se.expr (the gfc_se for i(:)). ?So, how do I populate i(1:5)
> > to 42.
>
> You want to fix the value of src.expr:
> I would suggest;
>
> if (code->expr3)
> {
> gfc_init_se (&src, NULL);
> gfc_conv_expr (&src, code->expr3); /*sgk*/
> gfc_add_block_to_block (&src.pre, &block); /*Check argument order*/
> tmp = gfc_evaluate_now (se.expr, &block);/*Ditto*/
> }
>
> tmp is now a temporary variable to which the desired expression is assigned.
After I posted my above code, I realized it was wrong. It
was the chunk left after a rather frustrating debugging session.
Thank for the snippet above, and more importantly
> >From then on, I suggest that you should borrow the code in
> trans-array.c that Erik and I used to make loops and put an assignment
> within the loop.
thanks fo this hint!
--
Steve