Silverfrost Forums

Welcome to our forums

Error reported on wrong line with /64 /undef

13 Aug 2022 2:35 #29280

The following test program uses an undefined value on line 54. When compiled with /undef and run, the resulting 32-bit program correctly indicates this line in the debugger or in the traceback.

When /64 /undef is used, however, it is line 53 that is flagged as the one in which an undefined variable is used. When I first ran into this error, I was quite baffled because line 53 contains

sBeamIN%Nodes(2) = MCON2

and the value of MCON2 was read in the fifth preceding line.

The test program source needed to be moved to a separate post because of the line limit.

13 Aug 2022 2:37 #29281

[continuation: the source code of the test program]

Module Base
   INTEGER, PARAMETER :: dp = selected_real_kind(15, 307)
   INTEGER, PARAMETER :: sw = 32, sa = 33, nta = 100
   REAL (KIND=dp), PARAMETER :: ZERO = 0.0_DP
end module Base

Module Elements
   use base
   implicit none
   integer, parameter ::   L = 3 !, nt = 120
   INTEGER astat
   Type Model
      Integer             id, NumTrias, NumBeams, ThicknessFlag
      Character*70        Description
      Real (kind = dp)    asm(6,6,18)
      Integer             ism(6,6,18)
      integer, allocatable ::  indexM(:,:), nodes(:), offsetnodes(:)
      integer             i,j,k,N,NodeCount,MaxNodeNumber,LoadedNodes
      integer        ::      flag = 0
      REAL (KIND=dp)      H, density
      REAL (KIND=dp), allocatable :: sk(:,:), xf(:), skI(:,:),b(:)
   END TYPE
   TYPE sbeam
      INTEGER id
      integer acad
      REAL (KIND=dp) width, depth, Ix, Iy, Iz, Area, Ratio, E, G1, &
         Beta1, Beta2,rho,t,b,d,density
      character*8 name
   END TYPE
   Type aBeam
      INTEGER             id, nodes(2), restraint(2), nodetype(2,6)
      integer :: flag   = 0
      REAL (KIND=dp)      x(2), y(2), z(2), mass(2), H(2)
      REAL (KIND=dp)      nu, em, x21, area2, esm(12,12), Ix,Iy,Iz,G, &
         Area, E, Beta1, Beta2, length, gamma
   end type
contains
   subroutine Read_beams(sBeamIN, sBeams)
      implicit none
      TYPE (aBeam),    TARGET :: sBeamIN
      TYPE (sbeam), TARGET :: sBeams(nta)
      Integer IV, MCON1, MCON2, beamid
      REAL (KIND=dp) gammaa
      TYPE (sbeam), POINTER :: beam => null()
      CHARACTER (4)        af
      CHARACTER (120)      iline
      iline = 'BEAM   1  1  2  0.0 43'
      READ(iline,*)af, IV, MCON1, MCON2,GAMMAA,beamID
      beam => sbeams(beamID)
      sBeamIN%ID = IV
      sBeamIN%ESM = ZERO
      sBeamIN%Nodes(1) = MCON1
      sBeamIN%Nodes(2) = MCON2
      sBeamIN%Iy = beam%iy     ! undefined, should stop here
      sBeamIN%Ix = beam%ix
      sBeamIN%IZ = beam%IZ
      return
   end subroutine
   Subroutine SetModel(ModelA, I, beams)
      implicit none
      TYPE (Model),       TARGET :: ModelA        !   holds the model data
      Integer I
      Integer Beams
      ModelA%ID = 1
      ModelA%NumTrias = 0
      ModelA%NumBeams = 65
      ModelA%MaxNodeNumber = 65
      ModelA%LoadedNodes = 67
      ModelA%Description = 'Dutch Bridge Goor'
      ModelA%ThicknessFlag = 2
      ModelA%H = 0.6
      ModelA%density = 2400
      I = 0
      Beams = 65
      return
   end Subroutine
End module

program Borr
   use Elements
   implicit none
   Integer             Triangles, BeamNum, I
   TYPE (Model),       TARGET :: ModelA
   TYPE (sbeam),       allocatable,   TARGET :: sBeams(:)
   TYPE (aBeam),       allocatable,   TARGET :: saBeams(:)
   Call SetModel(ModelA, Triangles, BeamNum)
   ALLOCATE (ModelA%indexM(3,1), ModelA%nodes(1),ModelA%offsetnodes(1),&
      sBeams(NTA), saBeams(Beamnum))
   ModelA%nodes = -1
   Do I = 1, Beamnum
      print *,'Calling Read_beams with I = ',i
      call Read_Beams(saBeams(I), sBeams)
      stop 'Read_Beams done'
   end do
end program Borr
13 Aug 2022 6:15 #29282

mecej4

Thank you for the feedback. I have made a note of this fault.

17 Nov 2022 1:43 #29636

This has now been fixed for the next release of FTN95.

Please login to reply.