Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29280 Discussions

Using EXTERNAL in Module Yields Compiler Error

brady
Beginner
562 Views
I have the following code in a single source file:
[fortran]MODULE MOD1

    EXTERNAL :: H_UMAT
    POINTER(P_UMAT, H_UMAT)

END MODULE MOD1

SUBROUTINE SUB1()

    USE MOD1

    CALL H_UMAT()

RETURN
END SUBROUTINE SUB1[/fortran]

When I compile it using:
[bash]ifort -c compiler_error.f90[/bash]

I get the following output on Windows:
[bash]Intel Visual Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1    Build 20090903 Package ID: w_cprof_p_11.1.046

Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

fortcom: Fatal: There has been an internal compiler error (C0000005).
compilation aborted for compiler_error.f90 (code 1)[/bash]

If I change the implementation of SUB1 to:
[fortran]SUBROUTINE SUB1()

	USE MOD1, ONLY : P_UMAT
    
    EXTERNAL :: H_UMAT
    POINTER(PX, H_UMAT)

    PX = P_UMAT
    CALL H_UMAT()

RETURN
END SUBROUTINE SUB1[/fortran]

It compiles without error. For what it's worth I observe the same behavior with IVF 11.1 on Linux as well:
[bash]: 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 compiler_error.f90 (code 3)[/bash]

Am I doing something wrong? Should I be able to use an EXTERNAL via a module the way I am?

Thanks,
Brady
0 Kudos
1 Reply
Steven_L_Intel1
Employee
562 Views
Hmm. I notre that this still is a problem in the current compiler - reported as DPD200166473. What you're doing is an extension to an extension, and one not widely supported. Let me suggest instead that you do this with standard F2003 syntax.

[plain]MODULE MOD1

ABSTRACT INTERFACE
SUBROUTINE UMAT_INT
END SUBROUTINE
END INTERFACE

PROCEDURE(UMAT_INT), POINTER :: H_UMAT


END MODULE MOD1

SUBROUTINE SUB1()

USE MOD1

PROCEDURE(UMAT_INT) :: REAL_UMAT

H_UMAT => REAL_UMAT

CALL H_UMAT()

RETURN
END SUBROUTINE SUB1[/plain]
0 Kudos
Reply