Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

write(*,*) syntax not working somehow.

Ye_T_
Beginner
410 Views

I know it's weird but here is the case.

The program I have wants to print out something on screen so I used write(*,*) 'xxxx'. It works perfectly fine before I moved my Fortran compiler to a new WIN 10 machine. Now it still compiled fine but whenever it runs to write(*,*), nothing is printed out and there is a severe (157) access violation error. Tried some other syntax such as write(6,*) but none works. I wonder if it's because of some settings I messed up in VS or fortran compiler.

Visual studio 2012, fortran XE2013 update 5.

Thanks.

0 Kudos
7 Replies
Steven_L_Intel1
Employee
410 Views

The problem is the access violation, not the syntax. Does this happen for any kind of WRITE or just a particular one in your program? Does a simple "Hello World" program work? (For example, the default new program console application template in VS.)

Since you didn't show us any code, nor did you tell us if you recreated the project or simply copied the project from the other system, it's hard to guess what the issue might be. I will throw out one possibility - you have an allocatable array that you assign to without explicitly allocating, and didn't enable the "Enable F2003 Semantics" option (or add /assume:realloc_lhs in the Command Line options.) There are many other possibilities.

0 Kudos
Ye_T_
Beginner
410 Views
Hi Steve,
 
Sorry I didn't make it clear. It happens to all kinds of screen printing syntax I can image, such as write(6,*), write(*,*), print *.
Hello world program works fine so I'd guess it's because some project properties that I made wrong for my project.
 
I recreated the project using source code. 
 
I think it's not necessary to show the codes as my print action doesn't involve any variables at all. Here I just attach some lines close to one of write(*,*) I have.
 
IF(VEHPROFILE(IVehType)%T == 1) THEN
  IF(.not.truckok) go to 200
ENDIF
IF(VEHPROFILE(IVehType)%T == 2) THEN
  IF(.not.hovok) go to 200
ENDIF
 
write(*,*) 'Assigning Vehicle. '
 
200 continue
 
0 Kudos
Steven_L_Intel1
Employee
410 Views

Please attach the .vfproj file for your project.

0 Kudos
Ye_T_
Beginner
410 Views

<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject ProjectCreator="Intel Fortran" Keyword="Console Application" Version="11.0" ProjectIdGuid="{9D485934-964F-49BC-9FD5-6A2F5F5E37C1}">
    <Platforms>
        <Platform Name="Win32"/>
        <Platform Name="x64"/></Platforms>
    <Configurations>
        <Configuration Name="Debug|Win32">
                <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" WarnInterfaces="true" Traceback="true" RuntimeChecks="rtChecksAll" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug"/>
                <Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" GenerateDebugInformation="true" SubSystem="subSystemConsole"/>
                <Tool Name="VFResourceCompilerTool"/>
                <Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
                <Tool Name="VFCustomBuildTool"/>
                <Tool Name="VFPreLinkEventTool"/>
                <Tool Name="VFPreBuildEventTool"/>
                <Tool Name="VFPostBuildEventTool"/>
                <Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
        <Configuration Name="Release|Win32">
                <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" Traceback="true" RuntimeChecks="rtChecksAll"/>
                <Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" SubSystem="subSystemConsole"/>
                <Tool Name="VFResourceCompilerTool"/>
                <Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
                <Tool Name="VFCustomBuildTool"/>
                <Tool Name="VFPreLinkEventTool"/>
                <Tool Name="VFPreBuildEventTool"/>
                <Tool Name="VFPostBuildEventTool"/>
                <Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
        <Configuration Name="Debug|x64">
                <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" WarnInterfaces="true" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug"/>
                <Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" GenerateDebugInformation="true" SubSystem="subSystemConsole"/>
                <Tool Name="VFResourceCompilerTool"/>
                <Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
                <Tool Name="VFCustomBuildTool"/>
                <Tool Name="VFPreLinkEventTool"/>
                <Tool Name="VFPreBuildEventTool"/>
                <Tool Name="VFPostBuildEventTool"/>
                <Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
        <Configuration Name="Release|x64">
                <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" Optimization="optimizeFull" VectorizationThreshold="90" PrefetchInsertionOpt="prefetchMedium" InterproceduralOptimizations="ipoSingleFile" MatrixLibrary="mlNo" RuntimeChecks="rtChecksNone" RuntimeLibrary="rtQuickWin"/>
                <Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalYes" SuppressStartupBanner="true" SubSystem="subSystemConsole" AdditionalDependencies="XXXXXXXX.lib"/>
                <Tool Name="VFResourceCompilerTool"/>
                <Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
                <Tool Name="VFCustomBuildTool"/>
                <Tool Name="VFPreLinkEventTool"/>
                <Tool Name="VFPreBuildEventTool"/>
                <Tool Name="VFPostBuildEventTool"/>
                <Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
    <Files>
        <Filter Name="Header Files" Filter="fi;fd"/>
        <Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"/>
        <Filter Name="Source Files" Filter="f90;for;f;fpp;ftn;def;odl;idl">
        <File RelativePath="..\v3.0\v3.0\Source New\XXXXXXX.f90">
            <FileConfiguration Name="Release|x64">
                <Tool Name="VFFortranCompilerTool" PrefetchInsertionOpt="prefetchMedium" InterproceduralOptimizations="ipoMultiFile"/></FileConfiguration></File>
       List XXXXXXX file configuration info
    <Globals/></VisualStudioProject>

 

0 Kudos
Steven_L_Intel1
Employee
410 Views

I don't see anything obvious here. Which configuration are you building? Does it happen with either a Debug or Release build? If you put a write(*,*) "Hello" at the start of the program, do you get the error?

0 Kudos
Ye_T_
Beginner
410 Views

I was calling the exe generated from this project A with another exe generated from another project B.

Here is the codes I used in project B to call A.exe.

 

                    INQUIRE (FILE='A.EXE', EXIST = EXT2)
                    IF(.NOT.EXT2) THEN
                        WRITE(911,*) "ERROR, A.EXE not found"
                        STOP
                    ENDIF    
                    
                    MS = SYSTEM("A.exe")


  The crash happens if I do write(*,*) anywhere in project A, even at the start of A. There is no error if I do write(*,*) in B.  

0 Kudos
Steven_L_Intel1
Employee
410 Views

What happens if you run A.EXE directly from a command prompt? Is project B a console application? Can you provide us with a complete test case (including both A and B projects)?

0 Kudos
Reply