"Segmentation fault occurred" occurs in Fortran, but the error disappears when the print statement is written
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.
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.