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

**Internal compiler error: segmentation violation with INTERFACE BLOCK

butette
Beginner
825 Views
Any reason why this should produce a compiler segmentation. I have 2 files junk1_mod.F90 and Interfaces_mod.F90.
So I compile

ifort -c junk1_mod.F90 <--- no problem here

when I compile Interfaces_mod.F90

ifort -c Interfaces_mod.F90

/tmp/ifortVR4J0A.i90: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.

compilation aborted for Interfaces_mod.F90 (code 1)

???? The odd part is the message went away if I just take out the type bound procedure definition junksub ni junk1_mod.F90.

Now if I just include the interface block inside another routine, that seems to be OK as well, but that would be a pain.

I have tried this on other compiler like xlf2003 w/o any problem.

This occurs even with either the latest 11.1 compiler or the 12.0 beta compiler.

=== file junk1_mod.F90

module junk1_mod

type :: junktype

integer :: i

contains

procedure junksub

end type junktype

contains

subroutine junksub(this,i)

class(junktype) :: this

integer :: i

end subroutine junksub

end module junk1_mod

=== file Interfaces_mod.F90

module Interfaces_mod

INTERFACE

subroutine test( junk )

use junk1_mod

type(junktype) :: junkin

end subroutine test

END INTERFACE

end module Interfaces_mod

0 Kudos
1 Solution
John4
Valued Contributor I
825 Views
As a workaround, you could put an import statement inside the interface block, and move the use statement outside the interface block:

[fortran]module Interfaces_mod

    use junk1_mod

    INTERFACE
        subroutine test( junk )
            import
            type(junktype) :: junk
        end subroutine test
    END INTERFACE

end module Interfaces_mod
[/fortran]

View solution in original post

0 Kudos
6 Replies
Steven_L_Intel1
Employee
825 Views
The nearly universal answer to an internal compiler error is "it's a compiler bug". Thanks - we'll take a look at this.
0 Kudos
Steven_L_Intel1
Employee
825 Views
Thanks for the nice test case. I have escalated this as issue DPD200161456. When I get any news about it, I will reply here.
0 Kudos
butette
Beginner
825 Views
Thank you Steve... in the meantime I will try to find a way to work around this problem.
0 Kudos
John4
Valued Contributor I
826 Views
As a workaround, you could put an import statement inside the interface block, and move the use statement outside the interface block:

[fortran]module Interfaces_mod

    use junk1_mod

    INTERFACE
        subroutine test( junk )
            import
            type(junktype) :: junk
        end subroutine test
    END INTERFACE

end module Interfaces_mod
[/fortran]

0 Kudos
butette
Beginner
825 Views
Thanks John... that seems to work. Although since my real code is a lot more involved with lots of routines in the interface blocks and lots of modules to be included, it would be a little messy, but I may just have to do that or redesign the code to use all TPB and not have this issues at all.
0 Kudos
Steven_L_Intel1
Employee
825 Views
This was fixed in version 12 Update 1.
0 Kudos
Reply