Subject: Re: hpf2dep

From: Zheng Gengbing <[email-masked]>
Date: Fri, 5 Apr 1996 08:44:22 +0800 (EAT)

On Thu, 4 Apr 1996, Guansong Zhang wrote:

> I can not parse the following program use hpf2dep in 1.23. (Please notcie the
> print statement is commented out.) I enven cann't get a memory fault error! the
> machine simply freezed! How about yours?
>

	You are right , after i examine the f90.y , I realy found the error
in dummy_args 's production.

> 
> ---------------------------------
> 
>       PROGRAM MAIN
>       REAL X(2:99), Y(100)
> !HPF$ PROCESSORS P(4)
> !HPF$ TEMPLATE TX(400),TY(-200:199)
> !HPF$ DISTRIBUTE TX(BLOCK) ONTO P
> !HPF$ DISTRIBUTE TY(BLOCK) ONTO P
> !HPF$ ALIGN X(i) WITH TX(2*i+1)     ! some crazy alignment
> !HPF$ ALIGN Y(i) WITH TY(3*i-50)
> 
>       FORALL (i=2:99) X(i) = 0
>       FORALL (i=1:100) Y(i) = i
> 
>       FORALL (i=2:99) X(i) = Y(i+1) + Y(i-1)
> 
>       CALL FOO(X(2:98:2),Y(1:99:2))
>       CALL FOO(X(3:99:2),Y(2:100:2))
> 
> !     PRINT *, (X(i),i=2,99)        ! back to beginning ?
>       END
> 
>       SUBROUTINE FOO(X,Y)
>       REAL X(49), Y(50)
> !HPF$ INHERIT X,Y
> 
>       FORALL (i=1:49) X(i) = X(i) - Y(i) - Y(i+1)
> 
>       RETURN
>       END
> 

	The problem is when X,Y are used as dummies of FOO , the id_list of
their symbol table are already used and link X and Y :X->Y , when INHERIT 
dirctive use dummy_args , the program try to go through the id_list and find 
the last one :Y, then make the link : Y->Y which cause a cycle .

	I 'v  modified the f90.y like this:

dummy_arg
    :  name   {
                                                /*  modified zheng.gb */
          /*$$ = makeSymbUnithead(fi,VARIABLE_NAME,$1); */
          $$ = makeSymbVar(fi,cur_scope(),INPUT,$1,0);
          $$->entry.var_decl.local = INPUT;
                                                /* added by zheng.gb */
          $$->id_list = SMNULL;
          }
    |  MULTIPLY    {
                                                /* modified by zheng.gb */
/*
          $$ = fi->head_symb;
*/
          $$ = makeSymbVar(fi,cur_scope(),INPUT,"*",0);
                                                /* added by zheng.gb */
          $$->id_list = SMNULL;
          }
    ;

	The only change is just assign SMNULL to overwrite the id_list used 
before.

	You can wait until the next version or try to modify yourself.

Thanks .

***************************************************************************
*     Zheng Gengbin                 *                                     *
*                                   *                                     *
*  Dept. of Computer Science        *  Phone:  86-10-2585088              *
*         & Technology              *  Email:                             *
*                                   *      [email-masked]   *
*  Peking University P.R.China      *  Mail:                              *
*                                   *      Room 1077 ,Building 47,        *
*                                   *      Peking University, P.R.China   *
***************************************************************************