Backtrace For This Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About backtrace for this error fortran Us Learn more about Stack Overflow the company Business Learn more about hiring ruby error backtrace developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Fortran Segmentation Fault Invalid Memory Reference
the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “Segmentation Fault (core dumped)” error
Segmentation Fault Gfortran
in Fortran gfortran linux up vote 0 down vote favorite I am creating a program which will analyse a file .fits in a directory and then it will create another file .txt in another directory. It is just a converter. When I tried to execute the program (compiling is OK) it gives me an error message: Program received signal SIGSEGV: Segmentation fault - invalid memory reference. gfortran backtrace Backtrace for this error: 0 0x7FC5ADB1C117 1 0x7FC5ADB1C6F4 2 0x7FC5AD46C0AF 3 0x44E704 in ffthdu at fitscore.c:6893 4 0x405101 in MAIN__ at Codigo.f90:? Segmentation fault (core dumped) And there is another information: when I delete a stretch of the program which does the "write to the new .txt converter file" part, the program goes OK and it reads the entire .fits file! Here is this stretch: arq='spec-1.txt' open (29,file=arq,status='unknown') write(29,*) ' l(n) fa(n)' do n=1,naxes write(29,*) l(n), fa(n) end do I have declared the variable "arq" as a character and everything is OK. When I delete this stretch the segmentation fault does not appear any more, but I do not know what to do now because I need to pass the information to this .txt! And the "arq" string is not complete because I am just testing now, later I will add the entire directory. And here is the full program, I am using "gfortran Codigo.f90 -o TESTE -Lcfitsio -lcfitsio" to compile it: implicit none integer largo,status,hdnum,n,keysexist,keysadd,bitpix,naxis integer naxes,readwrite,blocksize integer i,j,k integer iF(3),iT(3),iw(3),iwe,il,ib,jb,iFold,iFoldmin(3) integer iFoldmax(3),iFoldopt(3) integer iMiMy,iMo,Tymin,Tymax,Timin,Timax,Tyoung(3),Tint(3),Told integer i912,i45000,Tyin,Tiin,nrows,ncols,datacode,repeat,width integer nlam_ext integer fKD,fKK,fKKD parameter (nlam_ext = 1145) CHARACTER NAMECH*256,name2*256,alibi*1000,card*80,code*14 CHARACTER arq*1000 CHARACTER name(7)*256,namein*256,nebname*256,nameout*256 CHARACTER nameindva*256,nameoutdva*256,mid(3)*4,line*1000 r
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About
Fortran Segmentation Fault (core Dumped)
Us Learn more about Stack Overflow the company Business Learn more about hiring segmentation fault in fortran 90 developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join segmentation fault 11 fortran the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up SIGFPE: Floating-point exception backtrace for http://stackoverflow.com/questions/20453315/segmentation-fault-core-dumped-error-in-fortran-gfortran-linux this error: 0x7F70C71AF7D7 up vote 1 down vote favorite I use a Fortran 90 model under Ubuntu 14.04. The gfortran 95 compiler (gfortran 4:4.8.2-1ubuntu6) and the gcc 4:4.8.2-1ubuntu6 are installed by Ubuntu Software Center. After I ran the model I get the following error message: Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation. Backtrace for this error: #0 0x7F70C71AF7D7 #1 0x7F70C71AFDDE #2 0x7F70C68EAD3F #3 http://stackoverflow.com/questions/28557952/sigfpe-floating-point-exception-backtrace-for-this-error-0x7f70c71af7d7 0x7F70C6EB6913 Could someone explain me what these backtrace codes mean? How can I handle these errors? ubuntu floating-point gfortran gcc4 share|improve this question asked Feb 17 '15 at 8:51 Beata 8619 Those numbers are values of the instruction pointer that some stack unwinding procedure found on the stack. You may (or may not) be able to feed them through addr2line to get function names and line numbers out of them. –tmyklebu Feb 17 '15 at 15:38 I tried addr2line and gdb to get the function names and line numbers but neither found it. (gdb) info symbol 0x7F2B31E0D7D7 No symbol matches 0x7F2B31E0D7D7, gdb) info line *0x7F2B31E0D7D7 No line number information available for address 0x7f2b31e0d7d7, addr2line -e KiD_SC_2D.exe 0x7F2B31E0D7D7 ??:0. Is there any other way to handle this error? –Beata Feb 18 '15 at 8:34 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote Use the options -O -Wall -fcheck=all -g -fbacktrace during compilation and run the executable. If this does not provide the necessary information, try running your program under gdb and/or valgrind. share|improve this answer answered Feb 23 '15 at 8:43 user4490638 add a comment| You
filtered due to spam. Bug58913 - Segmentation fault on real128 array Summary: Segmentation fault on real128 array Status: RESOLVED INVALID Alias: None Product: gcc Classification: Unclassified Component: fortran (show other bugs) Version: 4.8.0 Importance: P3 normal Target https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58913 Milestone: --- Assignee: Not yet assigned to anyone URL: Keywords: rejects-valid Depends on: Blocks: https://sourceforge.net/p/mingw-w64/bugs/487/ Reported: 2013-10-29 17:46 UTC by Rodrigo Rodrigues Modified: 2013-11-25 02:13 UTC (History) CC List: 0 users See Also: Host: Target: Build: Known to work: Known to fail: Last reconfirmed: Attachments Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description Rodrigo Rodrigues 2013-10-29 17:46:02 UTC I cannot "write" segmentation fault a variable which contains an array of real(kind=real128). Scalars seem to work right. I got this behavior when running this simple program: 01 program main 02 use iso_fortran_env 03 real(real128), dimension(2) :: a 04 a = (/0., 1./) 05 write(*,*) a 06 end program >gfortran main.txt -o main #successfully compiles! >main #runtime error! Program received signal SIGSEGV: Segmentation Fault - invalid memory reference. Backtrace for this error: #0 ffffffff Same error is obtained if I: I) change real(real128) backtrace for this to real(16) in line 03 II) change line 04 to a = (/0._real128, 1._real128) III) change line 04 to a = real((/0., 1./), kind=real128) IV) declare a variable "b", assign b = a and try to write "b" V) try to write the value of a pointer pointing to a VI) make variable "a" PARAMETER, SAVE, TARGET or ALLOCATABLE More weird is that the program successfully run if I: a) change line 05 to write(*,*) a(1) b) change line 05 to write(*,*) (/0., 1./) b) change line 05 to write(*,*) 2*a or any other expression whose result IS NOT a direct reference to "a" or any other variable with real128 array. c) put a write statement with a value or scalar variable of kind=real128 anywhere in the program's body, no matter if before, after or even inside the write statement of line 05 d) change real(real128) to any other real kind in line 03 e) make "a" scalar Any ideas? Comment 1 kargl 2013-10-29 19:36:43 UTC What operating system? Where did you get gfortran? Your program works for 4.7.4, 4.8.2, and trunk on x86_64 FreeBSD Comment 2 kargl 2013-10-29 19:40:27 UTC (In reply to kargl from comment #1) > What operating system? Where did you get gfortran? > > Your program works for 4.7.4, 4.8.2, and trunk on > x86_64 FreeBSD I take it back. Your program does not work as
for 32 and 64 bit Windows Bugs MinGW-w64 - for 32 and 64 bit Windows A complete runtime environment for gcc Brought to you by: jon_y, ktietz70, nightstrike Summary Files Reviews Support Wiki ▾ Wiki Wiki2 Mailing Lists Tickets ▾ External Testsuite Failures Bugs Support Requests Patches (Obsolete, use public Mailing List) Feature Requests News Discussion Donate Code Git ▾ web ironcrate mingw-w64 portablexdr Create Ticket View Stats Group v1.0 (example) Searches Changes Closed Tickets Open Tickets Help Formatting Help #487 OPEN bug in gFortran 5.1.0 Milestone: v1.0 (example) Status: open Owner: nobody Labels: gFortran OPEN (1) Priority: 5 Updated: 2015-10-05 Created: 2015-07-09 Creator: John Campbell Private: No mingw gFortran Ver 5.1.0 does not open files that exist, but reports "Program received signal SIGSEGV: Segmentation fault - invalid memory reference" The valid open statement is: OPEN (UNIT=98, FILE=JOURNAL, STATUS='UNKNOWN', IOSTAT=iostat, iomsg=msg) I have attached a short test program that exhibits the problem, together with listing of .bat, interactive gdb commands and trace of error report. Files that do not exist open successfully, but files that do exist fail, locking up the cmd.exe box. This bug means that programs can create files but not read from data files. gcc version 5.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) I am running in cmd.exe on Windows 7 Home Premium Service Pack 1 1 Attachments ver510e.tce Related Bugs: #487 Discussion John Campbell - 2015-07-10 I hope someone can review this bug report, as if my test results are generally the case, this gFortran version 5.1.0 is not useable. If you can't open an input file then a major group of Fortran programs can not be generated by this compiler. This problem does not exist with Ver 4.9.2 If you would like to refer to this comment somewhere else in this project, copy and paste the following link: Mark Hampson - 2015-07-31 I'm also getting this behavior. Edit: I'd like to add that this happens for both the 32bit and 64bit versions, with any combinations of ACCESS/STATUS/POSITION/ACTION. As long as the file already exits, the 5.1.0 rev0 builds will throw a SIGSEGV. Edit²: The build: "gcc-5-win64_5.1.1-20150715.7z" at "https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting