This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Help with TREEs


On Sat, Nov 29, 2008 at 09:20:16AM +0100, Paul Richard Thomas wrote:
> 
> Adding this wee block into the deallocate code:
> 
>        {
>          tmp = fold_build3 (COND_EXPR, pchar_type_node, tmp, errmsg, argh);
> 
>          gfc_add_modify (&block, check, tmp);
>        }
> 
> generates:
> 
>     character(kind=1) * CHECK.5;
>     character(kind=1) * ARGH.4;
>     character(kind=1) * ERRMSG.3;
>     integer(kind=4) astat.2;
>     integer(kind=4) stat.1;
> 
>     astat.2 = 0;
>     ERRMSG.3 = &"Attempt to deallocate an unallocated object"[1]{lb: 1 sz: 1};
>     ARGH.4 = &"OK"[1]{lb: 1 sz: 1};
>     CHECK.5 = astat.2 != 0 ? ERRMSG.3 : ARGH.4;
> 
> Which looks to be close to what you want., excepting that you will
> have to make a call to memcpy, using gfc_build_memcpy_call, to
> transfer the string, CHECK, to your variable.

Thanks Paul!  This will get me going in the right direction.
Having not looked at the trans*c files in the last 10-12 months,
I've completely forgotten much of the details.

The above is almost what I need.  If no problems occur, then 
assignment to the errmsg variable is completely skipped, so 
all the argh variables are superflous.

-- 
Steve


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