LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-13-2014, 05:25 PM   #1
AlexBB
Member
 
Registered: Mar 2014
Posts: 437

Rep: Reputation: Disabled
Segmentation fault (core dumped)


What does it mean in GFortran? I get it when I run a command ./a.out. Segmentation fault (core dumped) Thanks, - A.

Last edited by AlexBB; 12-13-2014 at 05:27 PM.
 
Old 12-13-2014, 05:31 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,412

Rep: Reputation: Disabled
Your program contains a serious bug/error, and was terminated by the operating system.

Typically, the program would have tried to access an invalid memory location. It's impossible to say what the problem might be without at least seeing the source code.
 
Old 12-13-2014, 07:41 PM   #3
flshope
Member
 
Registered: Jul 2009
Location: Murfreesboro TN (United States)
Distribution: Ubuntu 16.04.1, 14.04.4, Debian 8.6
Posts: 128
Blog Entries: 34

Rep: Reputation: 26
I have had segmentation faults several times from Fortran codes. The sorts of things I look for are:

undefined variables (I usually use 'IMPLICIT NONE' to eliminate this sort of thing)

variable type or length mismatch between variables in a calling argument list and the subprogram argument list

an array index way out of bounds (turn on the array bounds checker in the compiler)
 
Old 12-15-2014, 01:30 PM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,631
Blog Entries: 10

Rep: Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680Reputation: 1680
Well you got a core file, which if you have a debugger, you can view the backtrace or see information about program variables and such at the time that the segmentation fault occurred. You can use GDB for this. You should have compiled your program with the -g flag, if you haven't, then re-compile with the -g flag, re-run and if/when you encounter the segmentation fault and get a core file you can then load that up using GDB.
Code:
gdb <executable-file> core
I haven't done this for FORTRAN but I'd imagine that you'd have a backtrace or some other capability to give you a report on what happened. If all else fails, create debug in various points of the code to document program progress so you can better zero in on where you hit the segfault. Or just run from within the debugger and when it hits the fault, you should be able to determine where in your program you were before hitting the fault.
 
Old 12-16-2014, 07:23 AM   #5
flshope
Member
 
Registered: Jul 2009
Location: Murfreesboro TN (United States)
Distribution: Ubuntu 16.04.1, 14.04.4, Debian 8.6
Posts: 128
Blog Entries: 34

Rep: Reputation: 26
locate the source of the segmentation fault with a binary search

Another way to try to locate the source of the segmentation fault is with a sort of binary search in the source code by inserting output statements (e.g., WRITE(*,*)'message'). The idea is to bracket the fault location in the source code by what you see on the screen after execution. One problem with this approach is that once the segmentation fault has occurred, execution may stop without having "flushed" all of the print buffers, which is to say, that the output of some successfully executed WRITE statements may not reach the screen. To flush the buffers, use a STOP statement after the most recently inserted WRITE statement (removing the STOP when you insert the next WRITE and STOP). This type of binary search is a crude alternative if the debugger doesn't tell you what you want to know, but it might reduce the amount of code you will have to scan visually to find your error.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Segmentation fault (core dumped) mohammad taqy bayat Linux - Newbie 3 08-25-2014 02:10 AM
Segmentation fault (Core dumped) ramshank Linux - Newbie 4 04-24-2014 02:35 AM
segmentation fault (core dumped) - what??? Micro420 Programming 6 12-07-2006 01:03 AM
Segmentation fault (core dumped) plisken Linux - General 8 09-17-2003 03:32 AM
Segmentation fault (core dumped) hasanaydin Linux - General 0 03-27-2002 07:47 AM


All times are GMT -5. The time now is 10:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration