[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::fortran

Title:Digital Fortran
Notice:Read notes 1.* for important information
Moderator:QUARK::LIONEL
Created:Thu Jun 01 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1333
Total number of notes:6734

1215.0. "local array of unknown size: Regression from V3.8 to V4.1 (Variable name, constant, or expression invalid in this context)" by HYDRA::NEWMAN (Chuck Newman, 508/467-5499 (DTN 297), MRO1-3/F26) Fri Mar 07 1997 12:06

The following FORTRAN generates good code with DEC Fortran V3.8-711 on Digital
UNIX, but aborts on Digital Fortran 77 V4.1-92 with the following error:

fort: Severe: bad.f, line 2: Variable name, constant, or expression invalid in
this context
        real a1(i1), b1(i1)
---------------------^

Was this functionality intentionally ripped out?


        subroutine yellow (a1, i1)
        real a1(i1), b1(i1)
c
c Ignore the loops below.  They are just something I threw in
c so that the optimizer wouldn't be able to optimize away
c the allocation of array b1
c
c The important part is that the array b1 is a temporary array
c whose size is unkown at compile time.
c
        do ndx = 1, i1
          b1(ndx) = a1(a1(ndx))
        end do
        do ndx = 1, i1
          a1(b1(ndx)) = b1(ndx)
        end do
        return
        end


With V3.8, it reaches down from the stack by 4Kb, then loops doing the following:
	store a zero
	is this allocation big enough for the temporary array?
	reach down 8 Kb (1 page)
When it has checked to make sure it hasn't hit a guard page and has reached far
enough, it allocats the desired amount (16-byte padded) from the stack.

The only problem I can see is that for small allocations it may hit a guard page
and fail when the allocation should have fit, and that perhaps there should be a
TRAPB when this finishes.  Both of those should be pretty easy to fix, though.

								-- Chuck Newman
T.RTitleUserPersonal
Name
DateLines
1215.1QUARK::LIONELFree advice is worth every centFri Mar 07 1997 12:374
Well, it compiles ok using 7.1 on VMS, which is a bit "later", so I'd guess
that it was a bug that got fixed.  Dave will probably know for sure.

				Steve
1215.2WIBBIN::NOYCEPulling weeds, pickin' stonesFri Mar 07 1997 13:061
See #1119.
1215.3FixedTLE::EKLUNDAlways smiling on the inside!Fri Mar 07 1997 13:238
    	Yes, that's a bug, and we did not intend this.  It was
    also discussed in note 1167 (a slightly different variant).
    The bug existed starting with edit 81, and was fixed by
    edit 103.
    
    Cheers!
    Dave Eklund