Author Topic: fortran open statement crash  (Read 4164 times)

Offline karaul

  • Single posting newcomer
  • *
  • Posts: 4
fortran open statement crash
« on: June 12, 2018, 04:01:28 pm »
I downloaded and started new fortran application in CB 17.12 and put this simple code into main.f95

program main
    integer i
    OPEN (3,file='test.dat')
    READ (3,*) i
    CLOSE (3)
    write(*,*) ' i=',i
end

Then, successfully compilied and builded with gfortran as compiler, and it crashes with

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

 C:\Program Files (x86)\CodeBlocks\MinGW\bin> .\gfortran.exe --version

GNU Fortran (tdm-1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1560
Re: fortran open statement crash
« Reply #1 on: June 12, 2018, 04:11:18 pm »

Offline karaul

  • Single posting newcomer
  • *
  • Posts: 4
Re: fortran open statement crash
« Reply #2 on: June 12, 2018, 05:17:07 pm »
Thank you for the quick answer. Unfortunately, the suggested fix to replace "libgfortran-3.dll" does not work.

So, I need to change fortran compiler. I do not know how to do it yet, but it is hopefully described in the manual. 

PS: I used mingw from here https://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version6/
With this replaced compiler, it works now.
« Last Edit: June 12, 2018, 05:53:19 pm by karaul »