Silverfrost Forums

Welcome to our forums

Error in CHECKMATE but not in RELEASE

2 Aug 2019 7:32 #24146

The following code, when compiled with /CHECKMATE (DLL Rev 43) throws a CLEARWIN+ error of 'A Variable for %bb has not been given an initial value', then asks if I want to continue. This does not occur using /RELEASE. Note that there is not a single %bb in the following code.

	use mswin
	character*4:: xcproj=' '
	INTEGER:: I,J
	integer:: sheet_displayed,enable_save
	logical:: sheet_viewed(0:4)
   integer,external:: sheet_started
   common/sheet_temp/sheet_displayed,sheet_viewed,enable_save
   integer,external:: button1,button2,r
   integer,external:: ptract_generic,pcomp_generic

   LOGICAL:: local_error
   integer,external:: button_test
   integer(7):: handle_1,handle_2,handle_3,handle_4
   character*4:: priinv=' ',pbreg=' ',pupper=' ',plower=' ',pdate,prdesc(5)
   local_error = .false.
!   UPDPRJ_windows=.TRUE.
   sheet_viewed = .false.
   sheet_viewed(1) = .true.
   if(xcproj.ne.' ') sheet_viewed = .true.
   sheet_displayed = 1
   i = winio@('%sh&',handle_1)
   i = winio@('%ca[Principal Investigator and Bed codes]&')
   i = winio@('%bg&',rgb@(250,250,250))
   i = winio@('1. Principal Investigator: %rs[uppercase]%ff%nl&',priinv)
   i = winio@('2. Bed Code Region: %rs[uppercase]%ff%nl&',pbreg)
   i = winio@('3. Upper Bed Code: %rs[uppercase]%ff%nl&',pupper)
   i = winio@('4. Lower Bed Code: %rs[uppercase]%ff%nl&',plower)
   i = winio@(' ') ! close the previous sheet
   print *,'Sheet 1 built'
! Sheet 2 - State, County, Township (20 OF EACH ELEMENT, SO USE %ob)
   i = winio@('%sh&',handle_2)
   i = winio@('%ca[State, County, Township]&')
   i = winio@('%bg&',rgb@(250,250,250))
   i = winio@('%*.*ob&',4,1) ! s/b 4,21
   i = winio@('##%cbState%cbCounty%cbTownship%cb&')
   i = winio@(' ') ! close the previous sheet
   print *,'Sheet 2 built'
! Sheet 3 - Company, Tract, Mine (20 OF EACH ELEMENT, SO USE %ob; also, lots of buttons)
   i = winio@('%sh&',handle_3)
   i = winio@('%ca[Company, Tract, Mine]&')
   i = winio@('%bg&',rgb@(250,250,250))
   i = winio@('%*.*ob[line_colour]&',4,1,rgb@(0,255,0)) ! s/b 4,21
   i = winio@('##%cbCompany%cbTract%cbMine%cb&')
   i = winio@(' ') ! close the previous sheet
   print *,'Sheet 3 built'
! Sheet 4 - Dates and Descriptions
   i = winio@('%sh&',handle_4)
   i = winio@('%ca[Dates and Descriptions]&')
   i = winio@('%bg&',rgb@(250,250,250))
   i = winio@('11. Date (mm/dd/yy): %rs[uppercase]%ff%nl&',pdate)
   do i=1,5
       j = winio@('%3wd: %rs[UPPERCASE]%nl&',i,prdesc(i))
   end do
   i = winio@(' ') ! close the previous sheet
   print *,'Sheet 4 built'
   if(xcproj.ne.' ') then
   i = winio@('%ca[Enter/Edit Current Project Information for Project='//xcproj//']&')
   else
   i = winio@('%ca[Enter/Edit a New Project]&')
   endif
   i = winio@('%bfClick each of the TABS below to enter/edit the data, then click %~^bt[SAVE]  or %^bt[CANCEL]%ff%nl&',enable_save,button1,button2)
   i = winio@('%4ps[hot_track]',handle_1,handle_2,handle_3,handle_4)!`^,sheet_displayed,SHEET_STARTED)
!   updprj_windows = i.eq.1 ! return code of 1 means all work was accepted
   end
	integer function button1()
    button1 = 1
    return
    end
    integer function button2()
    button2 = 2
    return
    end
3 Aug 2019 2:21 #24147

Have no problem compiling. I'm lost which DLL version i have but this handy program (recommend to all to add to all your codes. Who was its author here?) tells that my Library date is 4:53:46 - 27:6:2019 Library version 21 6 26 21

Integer function LibraryVersion64()
C_EXTERNAL GetLibraryVersionInfo '_GetLibraryVersionInfo'():INTEGER(7) 
C_EXTERNAL GetLibraryDateInfo '_GetLibraryDateInfo'():INTEGER(7) 
C_EXTERNAL GetString 'GET_CSTRING@'(REF,VAL,REF) 
CHARACTER(80) info,info2 

call GetString(info, GetLibraryDateInfo(), 80) 
print*,'Library Date: ', info 

call GetString(info2, GetLibraryVersionInfo(), 80) 
!Year since 1998, month, day, hour... 
print*, 'Library Vers: ', info2 

i=winio@('%ww%sv%ff Library date: %ta%22rs%ff Library version: %ta%22rs%ff %nl%cn%bt[OK]',info, info2)


LibraryVersion64 = 2
end function
3 Aug 2019 2:56 #24148

The current compiler, with the /64 /CHECK_WINIO options, says:

S:\LANG\FTN95>ftn95 /64 /check_winio wahbb.f90 /link
[FTN95/x64 Ver. 8.51.0 Copyright (c) Silverfrost Ltd 1993-2019]

0021)    i = winio@('%sh&',handle_1)
*** Argument number 2 (HANDLE_1) of WINIO@ should be a 32 bit integer

I changed the type to INTEGER(3) and the program seemed to run fine.

3 Aug 2019 6:25 #24149

Bill

The error report arises because enable_save has not been given an initial value. It should say %BT and I will look into that.

This illustrates a new diagnostic check that may not be apparent when using the latest public update of the DLLs.

3 Aug 2019 7:11 #24153

This demonstrates that Clearwin+ has to work consistently with /checkmate (or /undef) and do the same what the FTN95 is doing : track such variables too. It missed the uninitialized variable. You are lucky, I could not find one crashing Clearwin bug for 10 years with exactly the same property sheet like in this demo. I can not make small reproducer because the property sheet is initially 100x larger, and with smaller demo bug disappears

4 Aug 2019 1:55 #24157

Paul, thanks for finding that. I'll correct my original code. As well as go through similar instances to make SURE I catch them before compilation.

This does bring up the information in the error message, like the line number or address at which the fault is found. I think there is another thread that addresses that concern.

Again, thanks! Bill

Please login to reply.