From: rudra on 23 Sep 2008 11:13 dear friends, My code, while compiling with ifort,is facing a segmentation fault while calling a subroutine. as it is large code, i am providing the part where main program is calling the subroutine and the subroutine's declaration itself. IN THE MAIN CODE: ienrp=ienrp+1 write(*,*) "callin hop" call hop(il,ienrp,nsite,nasite,nrsite,ntsite, & maxrec,map,lorbit,ienum,srl,npn,ap1, & ap6,ap7,ap8,ap9,ap10,ap11,ap12, & ap13,p2,p3,p4,xa,ya) istart=iend+1 ======================== THE SUBROUTINE DECLARATION: subroutine hop (il,ienrp,nsite,nasite,nrsite,ntsite, & maxrec,map,lorbit,ienum,srl,npn,ap1, & ap6,ap7,ap8,ap9,ap10,ap11,ap12,ap13, & p2,p3,p4,xa,ya) ======================== THE iidb IS PROMPTING ERROR LIKE: Intel(R) Debugger for applications running on IA-32, Version 35, Build 20080310 ------------------ object file name: irun Reading symbolic information from /matsc/students/Rudra/Recursion/ASR/ irun...done (idb) run<asr.in Concentration of Atom A = 0.600000000000000 Concentration of Atom B = 0.400000000000000 Reading AS-Map complete Reading STRUCTURE MATRIX complete Reading POTENTIAL PARAMETERS from POTPAR_A Reading POTENTIAL PARAMETERS from POTPAR_B callin hop Thread received signal SEGV stopped at [subroutine hop(integer*4, integer*4, integer*4, integer*4, integer*4, integer*4, integer*4, integer*4 (:,:), integer*4, integer*4, real*8 (:,:,:), integer*4, real*8 (:), real*8 (:), real*8 (:), real*8 (:), real*8 (:), real*8 (:), real*8 (:), real*8 (:), real*8 (:), real*8 (:), real*8 (:), real*8 (:), real*8 (:,:), real*8 (:,:)):42 0x0804d0c6] 42 write(*,*) "running hop" WILL ANYBODY PLZ HELP ME?
From: Steve Lionel on 23 Sep 2008 12:00 On Tue, 23 Sep 2008 08:13:49 -0700 (PDT), rudra <bnrj.rudra(a)gmail.com> wrote: >dear friends, >My code, while compiling with ifort,is facing a segmentation fault >while calling a subroutine. as it is large code, i am providing the >part where main program is calling the subroutine and the subroutine's >declaration itself. You don't show the declarations of the arguments in hop, but the idb output leads me to suspect that one or more of the arguments are assumed-shape arrays, with dimension (:) or (:.:). If so, Fortran requires that an explicit interface for routine hop be visible to the caller. Is it? What happens if you rebuild your application, adding the options: -gen-interface -warn interface ? -- Steve Lionel Developer Products Division Intel Corporation Nashua, NH For email address, replace "invalid" with "com" User communities for Intel Software Development Products http://softwareforums.intel.com/ Intel Fortran Support http://support.intel.com/support/performancetools/fortran My Fortran blog http://www.intel.com/software/drfortran
From: rudra on 23 Sep 2008 23:28 i have not used explicit interface and called the subroutines directly. as u have asked,using -gen-interface -warn interface is not giving any difference!
From: Richard Maine on 24 Sep 2008 00:11 rudra <bnrj.rudra(a)gmail.com> wrote: > i have not used explicit interface and called the subroutines > directly. I don't know what "calling directly" means; that's not a Fortran term. But if the subroutines have assumed-shape dummy arguments as Steve surmises, then it is erroneous to call them without an explicit interface, and segmentation fault is a very likely outcome of such an erroneous call. If so, that is almost certainly your problem. But given the precision of the data presented, I'm not convinced that you actually know whether you have an explicit interface. For example, if the subroutines are in a module and you USE the module, then you have an explicit interface. Perhaps by "calling directly", you mean that you didn't do that, but I'm just guessing as the terminology doesn't match. -- Richard Maine | Good judgement comes from experience; email: last name at domain . net | experience comes from bad judgement. domain: summertriangle | -- Mark Twain
From: Richard Maine on 24 Sep 2008 00:48
Richard Maine <nospam(a)see.signature> wrote: > rudra <bnrj.rudra(a)gmail.com> wrote: > > and 1 more thing to notice is that while compiling with gfortran, its > > NOT giving any error. Oh, I forgot to comment on that before. You have twice used the phrase "while compiling". Is the error you get in fact while compiling or is it while running the compiled code? The two things are *VERY* different. I (and presumably Steve) have been assuming that you didn't actually mean that you got the error "while compiling". If you meant that literally, then none of the previous responses apply. -- Richard Maine | Good judgement comes from experience; email: last name at domain . net | experience comes from bad judgement. domain: summertriangle | -- Mark Twain |