Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
21 Views

"Segmentation fault occurred" occurs in Fortran, but the error disappears when the print statement is written

Dear all,

I am creating a program in Fortran90.

"Forrtl: severe (174): SIGSEGV, segmentation fault occurred" occurs in an array in a structure.
I tried to check the index by writing a print statement to identify the cause, but the error disappeared when I wrote the print statement for some reason. Also, when I added -check bounds, the error disappeared as well.

The compiler used intel Fortran, and an error occurred at that time, but when using gfortran, no error occurred.

If you know the cause, can you tell me?

Thank you.

0 Kudos
1 Reply
Highlighted
Valued Contributor I
21 Views

Very likely there is a flaw in your code. Could you post the code? The segmentation fault most likely happens because you are trying to access some part of memory that is not allocated. The print statement might counteract that, e.g. because the compiler/optimizer does not inline some part of the code.

0 Kudos