User forums > Using Code::Blocks

Program received signal SIGSEGV: Segmentation fault - invalid memory reference

(1/2) > >>

maxlox:
Hi, I've write a simple program in fortran as follow:


--- Code: ---    program file1

    implicit none

    ! Prompt user for a filename and read it:
    CHARACTER*64 filename
    character*64 reading
    WRITE (*, '(A)') ' enter file to create: '
    READ (*, '(A)') filename
    ! Open the file for formatted sequential access as unit 7.
    ! Note that the specified access need not have been specified,
    ! since it is the default (as is "formatted").
    OPEN (7, FILE = filename, ACCESS = 'SEQUENTIAL', STATUS = 'NEW')
    write(7,*)'Nuovo file'

    open(10,file='pippo', access='sequential', status='old')
    read(10,*)reading
    close(7)
    close(10)

    write(*,*) reading

    print *, 'Hello World'

    end program file1
--- End code ---

When I run it under Code::Blocks (ver. 17.12, the latest) ide o in command prompt I get an error message as in the image attached. Code::Blocks is installed in a OS windows 10 ( :o ) 64bit.
If I compile and run the same code with "my old computer" (a virtual machine over the same computer), with xp and visual studio intel fortran , all is good!

Can someone help me and show were I fall?

Thanks

stahta01:
Please state the GCC and/or FORTRAN compiler version for both working and non-working versions.
Some GCC Compilers have know FORTRAN bugs!

Tim S.

maxlox:

--- Quote from: stahta01 on June 04, 2018, 07:27:48 pm ---Please state the GCC and/or FORTRAN compiler version for both working and non-working versions.
Some GCC Compilers have know FORTRAN bugs!

Tim S.

--- End quote ---

Non working fortran compiler ver is the mingw32-gfortran.exe "GNU Fortran (tdm-1) 5.1.0".
The other, my old fortran compiler, working ver is the "Intel(R) Fortran Compiler 10.1.021 [IA-32]".

It's a compiler's bug?? Can I fix in someway?

stahta01:

--- Quote from: maxlox on June 05, 2018, 12:11:49 am ---
--- Quote from: stahta01 on June 04, 2018, 07:27:48 pm ---Please state the GCC and/or FORTRAN compiler version for both working and non-working versions.
Some GCC Compilers have know FORTRAN bugs!

Tim S.

--- End quote ---

Non working fortran compiler ver is the mingw32-gfortran.exe "GNU Fortran (tdm-1) 5.1.0".
The other, my old fortran compiler, working ver is the "Intel(R) Fortran Compiler 10.1.021 [IA-32]".

It's a compiler's bug?? Can I fix in someway?

--- End quote ---

IIRC, "GNU Fortran (tdm-1) 5.1.0" is the bad FORTRAN compiler.
I would try an older or newer GCC FORTRAN compiler.

Tim S.

maxlox:

--- Quote ---
IIRC, "GNU Fortran (tdm-1) 5.1.0" is the bad FORTRAN compiler.
I would try an older or newer GCC FORTRAN compiler.

Tim S.

--- End quote ---

I'll try ...  :'( :'(

Thanks Tim S. "stahta01"

Navigation

[0] Message Index

[#] Next page

Go to full version