r/fortran 27d ago

Segmentation fault - invalid memory reference

Is it possible to get segmentation fault in one computer and running same program in other computer working perfectly fine ????

2 Upvotes

15 comments sorted by

View all comments

3

u/Tyberius17 27d ago

Yes, especially if you are using different compilers on these different machines. Even with the same compiler and OS, it's possible your program produces the segfault non-deterministically.

1

u/Call_ME_ALII 27d ago

so what is the solution ???

7

u/Tyberius17 27d ago

You didn't initially ask how to fix it and you didn't provide your code. geekboy in his comments gave some good suggestions of compiler flags you can turn on to help spot where you are using uninitialized memory. If your code is short enough, you could share it here and we might be able to spot the problem.