Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

mysterious ifort segmentation fault

may_ka
Beginner
628 Views

Hi all,

I observed an ifort (17.07 and 18.03) segmentation fault when compiling my hierarchical stack of libraries. I had done some work on code in low level libraries which always compiled fine. Today I decided to recompile the whole stack of libraries and all applications and all of a sudden ifort crashed on code which I had not touched. The code include functionality from the low level libraries via "use", and commenting the use statement made the segfault disappearing. As the code behind the use statement was definitely free of bugs, I dug deeper and found the following: changing from

Module mod_bla
  use mod_1
  Type :: bla_type
     .....
   contains
     Procedure, pass :: a1 => SubA1
   end type bla_type
contains
Subroutine SubA1(this)
  use mod_2
End Subroutine

to

Module mod_bla
  use mod_1
  use mod_2
  Type :: bla_type
     .....
   contains
     Procedure, pass :: a1 => SubA1
   end type bla_type
contains
Subroutine SubA1(this)
End Subroutine

"resolved" the problem. Thus, what I had to do is to move all "use" statements when they occured in subroutines within the module to the top of the module.

Has anybody ever experienced this problem??? It wrecked my night because all my libraries backing commercial applications which all of a sudden couldn't be compiled any more.

cheers

 

0 Kudos
2 Replies
mecej4
Honored Contributor III
628 Views

You only gave an outline of the problem, so what follows is a guess: do any of the modules that you use contain interface blocks? If so, you should note that there are limitations on named host entities being accessible/visible in an interface block, and the IMPORT statement (available in F2003 and above) is provided to resolve such issues.

See if this old thread is relevant: https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/268970 .

A collection of slides on the topic, by Nick Maclaren: http://people.ds.cam.ac.uk/nmm1/fortran/paper_08.pdf

0 Kudos
may_ka
Beginner
628 Views

Hi,

sorry but I cannot provide more than an outline. The libraries encompass ~150,000 lines of code, and I could not reproduce the compiler segfault with a simple example. I had a similar issue about 2 years ago and I had to hand all my code to intel. Then they found a compiler bug, offered a quick fix.

I use interfaces heavily because almost all routines are type bound and the code of the routine body is placed in a submodule. I also use abstract interfaces together with the "import" keyword. Never had an issue.

Cheers

0 Kudos
Reply