[Patch, Fortran] PR fortran/39626: Implement Fortran 2008's BLOCK construct

Daniel Kraft d@domob.eu
Tue Sep 29 08:20:00 GMT 2009


Tobias Burnus wrote:
> Am 28.09.2009 16:47, schrieb Daniel Kraft:
>> here's my revised patch to implement the BLOCK construct that will
>> appear in the upcoming Fortran 2008 standard.  I personally believe that
>> this is some really nice feature that missed for a long time, and also
>> heard others say they'd like to have something like this in Fortran.
> I also missed it a couple of times when I wanted to temporary add some
> debugging WRITEs. One usually needs additionally variables which was
> inconvenient  for lengthy subroutines.
> 
>> The patch is against today's trunk and passed both a full bootstrap and
>> regression test on GNU/Linux-x86-32.  Ok for trunk?
> 
> The patch looks good to me. It sometimes makes the diagnostics less
> useful, e.g. for

Thanks for the quick review, committed as rev. 152266.

> recursive function func(i)
>   integer :: i, func
>   func = 1
> entry func2(i)
>   block
>     func2 = func(1)
>   end block
> end function func
> 
> But the same "Unclassifiable statement" one gets if one not only removes
> "(end )block" but also "recursive".

As discussed on IRC, I'll update the PR now with BLOCK's status and also 
mention this problem (and maybe work it out during stage 3).

I'll also mark BLOCK as "experimental" supported in the wiki.

>> PPS: In block_2.f08, is there an easy way to check that the local
>> allocatable array gets free'ed on exit of the block?  (Marked by an XXX
>> comment)  If not, I think it won't hurt much to just get rid of the
>> comment and not check this, but if there is, it would be cool to add
>> this check.
> 
> You could try -fdump-tree-original together with some pattern in
> ! { dg-final { scan-tree-dump-times "<pattern>" <count> "original" } }

Thanks for the hint, I think I got a good pattern now and updated my 
patch before the commit.

Yours,
Daniel

-- 
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri



More information about the Gcc-patches mailing list