Silverfrost Forums

Welcome to our forums

Express Access Violation, PLATO No Problem

22 Dec 2011 6:03 #9389

The following code compiles in PLATO but gets an access violation in Express.

module BUFFER_MOD

   type,public	:: buffer_type
      private
      character	:: BUF_CHARS(3836)=Z'00'
   end type buffer_type;

   type(buffer_type),save	:: The_Buffer
contains
   subroutine load(inbytes,offset)
      character(len=*),intent(in)			:: inbytes
      integer(kind=SELECTED_INT_KIND(9)),intent(in)	:: offset
      integer(kind=SELECTED_INT_KIND(9))			:: inlen

      inlen = length(inbytes)-offset
      The_Buffer%BUF_CHARS(1:inlen) = inbytes(offset+1:length(inbytes))
      return

   end subroutine load

   SUBROUTINE pckout(outword,wordno)
   
      integer(kind=SELECTED_INT_KIND(18)),intent(out)	:: outword
      integer(kind=SELECTED_INT_KIND(9)),intent(in)	:: wordno
      integer(kind=SELECTED_INT_KIND(9))              :: bdex,indx,itemp,imask=63

      bdex = (wordno-1)*6 + 1

      outword = 0
      do indx = bdex,bdex+5
         itemp = ichar(The_Buffer%BUF_CHARS(indx))
         itemp = iand(itemp,imask)
         outword = outword + itemp
         outword = ishft(outword,6)
      enddo
      outword = ishft(outword,22)
      return

   end SUBROUTINE

end module BUFFER_MOD



 0042b7aa broadcast_scalar(<ptr>structÄconstant_entity,<ptr>structÄtype_definition) [+0056]
 0042bd32 make_new_variable(<ref>(<ptr>char),int,longÄlongÄint,int,<ptr>structÄtoken,enum [+49af]
 0043126d add_variables(int,longÄlongÄint,int,<ptr>char,<ptr>structÄtoken,enumÄlogical) [+007a]
 0040aa43 parse_declaration_statement(<ptr>char,int,int,<ref>int) [+39a4]
 004124a7 handle_token(<ptr>char,int,int,int,int,<ref>int) [+0e0a]
 00405193 ProcessEntireLine(void) [+068f]
 004061db compile(<ptr>char) [+013e]
 00
23 Dec 2011 9:46 #9390

Both IDEs access the FTN95 compiler but presumbly with different command line switches. Again for both IDEs you can find out how FTN95 was called by looking at the build log. In the case of Plato you will need to open a text file called BuildLog. In the case of Visual Studio (I think) you follow a link in the Output window (holding down the control key).

When you have worked out how the command line switches differ, you will be in a position to identify which switch is causing the problem.

23 Dec 2011 4:55 #9394

Here's the BuildLog...

00000000  46 00 54 00 4E 00 39 00-35 00 2E 00 45 00 58 00  F.T.N.9.5...E.X.
00000010  45 00 20 00 22 00 43 00-3A 00 5C 00 42 00 55 00  E. .'.C.:.\\.B.U.
00000020  46 00 46 00 45 00 52 00-2E 00 66 00 39 00 35 00  F.F.E.R...f.9.5.
00000030  22 00 20 00 2F 00 4E 00-4F 00 5F 00 42 00 41 00  '. ./.N.O._.B.A.
00000040  4E 00 4E 00 45 00 52 00-20 00 2F 00 56 00 53 00  N.N.E.R. ./.V.S.
00000050  37 00 20 00 2F 00 44 00-45 00 4C 00 45 00 54 00  7. ./.D.E.L.E.T.
00000060  45 00 5F 00 4F 00 42 00-4A 00 5F 00 4F 00 4E 00  E._.O.B.J._.O.N.
00000070  5F 00 45 00 52 00 52 00-4F 00 52 00 20 00 2F 00  _.E.R.R.O.R. ./.
00000080  45 00 52 00 52 00 4F 00-52 00 5F 00 4E 00 55 00  E.R.R.O.R._.N.U.
00000090  4D 00 42 00 45 00 52 00-53 00 20 00 2F 00 55 00  M.B.E.R.S. ./.U.
000000A0  4E 00 4C 00 49 00 4D 00-49 00 54 00 45 00 44 00  N.L.I.M.I.T.E.D.
000000B0  5F 00 45 00 52 00 52 00-4F 00 52 00 53 00 20 00  _.E.R.R.O.R.S. .
000000C0  2F 00 43 00 48 00 45 00-43 00 4B 00 4D 00 41 00  /.C.H.E.C.K.M.A.
000000D0  54 00 45 00 20 00 2F 00-46 00 50 00 50 00 20 00  T.E. ./.F.P.P. .
000000E0  2F 00 42 00 49 00 4E 00-41 00 52 00 59 00 20 00  /.B.I.N.A.R.Y. .
000000F0  22 00 43 00 68 00 65 00-63 00 6B 00 4D 00 61 00  '.C.h.e.c.k.M.a.
00000100  74 00 65 00 5C 00 57 00-69 00 6E 00 33 00 32 00  t.e.\\.W.i.n.3.2.
00000110  5C 00 42 00 55 00 46 00-46 00 45 00 52 00 2E 00  \\.B.U.F.F.E.R...
00000120  6F 00 62 00 6A 00 22 00-20 00 0D 00 0A 00        o.b.j.'. .....

I can't find the log from Express. The switches should be the defaults for a new project.

23 Dec 2011 5:19 #9395

OK. For Plato you are using Win32 (not .NET) and CHECKMATE.

I am not using the Express edition but for Visual Studio 2010 you go to the Output window (after a build) where it has 'Build log saved at:'.

Hold down the Ctrl key and click on the link to a file.

I don't know what the default is but it could be Win32 and DEBUG (which should also appear in combo boxes on the main toolbar).

This being the case, let me know because this is strange.

23 Dec 2011 5:29 #9396

If I just compile, I get the access violation and no log. If I build, the module compiles but the link fails because there is no main program. More confusing?

/////////////////////////////////////

Build log for project: FortranApplication1
Configuration: CheckMate/Win32
Date: 23/12/2011 - 11:23:57

/////////////////////////////////////

System Configuration
////////////////////

Path Directories:
C:\\Program Files\\Silverfrost\\FTN95
C:\\Program Files\\Silverfrost\\FTN95 Express\C:\\Ruby187\\bin
C:\\WINDOWS\\system32
C:\\WINDOWS
C:\\WINDOWS\\System32\\Wbem
C:\\Program Files\\Common Files\\Roxio Shared\\DLLShared\C:\\Program Files\\ActivIdentity\\ActivClient\C:\\Program Files\\Symantec\\pcAnywhere\c:\\cleanscape\\flint\\main
C:\\Program Files\\QuickTime\\QTSystem\C:\\Program Files\\bin
C:\\Program Files\\gfortran\\libexec\\gcc\\i586-pc-mingw32\\4.5.0
C:\\Program Files\\gfortran\\bin
C:\\yaxx\\GnuWin32\\bin
C:\\cvs
%cygwin%\\bin
C:\\Documents and Settings\\s095122\\My Documents\\IOSSP\\Merger and Quick\\xmlconvert
c:\\mingw\\bin

Project Directory: C:\\Documents and Settings\\s095122\\My Documents\\Silverfrost FTN95 Express\\FortranApplication1\\FortranApplication1\Output Directory: C:\\Documents and Settings\\s095122\\My Documents\\Silverfrost FTN95 Express\\FortranApplication1\\FortranApplication1\\CheckMate\\Win32
Output File: CheckMate\\Win32\\FortranApplication1.exe

Project Build
/////////////

   C:\\Documents and Settings\\s095122\\My Documents\\Silverfrost FTN95 Express\\FortranApplication1\\FortranApplication1\\FreeFormat1.f95

Compiling...

Compiling file: FreeFormat1.f95
FTN95.EXE 'C:\\Documents and Settings\\s095122\\My Documents\\Silverfrost FTN95 Express\\FortranApplication1\\FortranApplication1\\FreeFormat1.f95' /NO_BANNER /CHECKMATE /FULL_DEBUG /P6 /FPP/REF 'c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.dll' /REF 'c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.Data.dll' /REF 'c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.XML.dll' /VS8 /DELETE_OBJ_ON_ERROR /ERROR_NUMBERS /UNLIMITED_ERRORS /BINARY 'CheckMate\\Win32\\FreeFormat1.obj'

Linking...

Command line for link:
   slink.exe -OUT:'CheckMate\\Win32\\FortranApplication1.exe' @'C:\\Documents and Settings\\s095122\\My Documents\\Silverfrost FTN95 Express\\FortranApplication1\\FortranApplication1\\link.lst' 'c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.dll' 'c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.Data.dll' 'c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\System.XML.dll'
Linker output: 
   *** No main, WinMain or LibMain function


FortranApplication1 build failed.

/////////////////////////////////////
23 Dec 2011 6:10 #9397

Chances are you need to remove the references (/REF) to system.dll etc. They are not relevant and may be the source of the problem.

Go to the 'Project Explorer' window and delete these references.

Please login to reply.