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

Internal compiler error with v17 on code that compiles ok with v16

johnyb_
New Contributor I
385 Views

While testing our code base with ifort v17, the following code compiles and executes correctly with ifort v16.0.2, but gives an internal compiler error with ifort v17.0

module mod_t

    type t
        integer val_t

        contains
       
        procedure, private             :: t_ass_i
        procedure, private, pass(expr) :: i_ass_t
        generic   :: assignment(=)     => t_ass_i , i_ass_t

        procedure, private             :: t_plus_i
        procedure, private, pass(b)    :: i_plus_t
        generic   :: operator(+)       => t_plus_i, i_plus_t
    end type
    
    
    contains
        subroutine t_ass_i(var,expr)
            class(t), intent(out) :: var
            integer , intent(in)  :: expr
            var%val_t = expr
        end subroutine

        subroutine i_ass_t(var,expr)
            integer , intent(out) :: var
            class(t), intent(in)  :: expr
            var = expr%val_t
        end subroutine

        type(t) function t_plus_i(a, b)
            class(t), intent(in) :: a
            integer , intent(in) :: b
            t_plus_i%val_t = a%val_t + b
        end function
    
        type(t) function i_plus_t(a, b)
            integer , intent(in) :: a
            class(t), intent(in) :: b
            i_plus_t = b + a
        end function
        
end module mod_t

program cata_1
    use mod_t

    type(t) :: a
    integer :: b
    a%val_t = 11
    b       = 31
    b       = b + a
    print *, b
end program

this is the output with v16:

C:\dev\f95\bugs\intel>ifort tkr_5.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.180 Build 20160204
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 11.00.61030.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:tkr_5.exe
-subsystem:console
tkr_5.obj

C:\dev\f95\bugs\intel>tkr_5
          42

and this is with v17:

C:\dev\f95\bugs\intel>ifort tkr_5.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0 Build 20161005
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

tkr_5.f90(1): catastrophic error: **Internal compiler error: internal abort** 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 tkr_5.f90 (code 1)

C:\dev\f95\bugs\intel>

I am not quite certain if perhaps we are violating TKR and the code only accidentally works in v16 (we had a few similar issues while testing our code with v17) but I am certain the compiler should not crash.

 

0 Kudos
4 Replies
Steven_L_Intel1
Employee
385 Views

I don't see anything wrong with your code. Escalated as issue DPD200416722. Thanks.

0 Kudos
johnyb_
New Contributor I
385 Views

Thanks Steve for the quick reply.

It's reassuring to know we didn't work with nonconformant code. So we'll stick with the v16 compiler until this is fixed, as it breaks an essential part of our code.

 

 

0 Kudos
johnyb_
New Contributor I
385 Views

I have experimented further, and even this simplified version which is I think pure Fortran 95, without type bound procedures and generics crashes the v17 compiler:

module mod_t
    type t
        integer val_t
    end type
    
    interface operator(+)
        module procedure i_plus_t
    end interface
    
    interface assignment(=)
        module procedure i_ass_t
    end interface

    contains

        subroutine i_ass_t(var,expr)
            integer , intent(out) :: var
            type(t), intent(in)  :: expr
            var = expr%val_t
        end subroutine
   
        type(t) function i_plus_t(a, b)
            integer , intent(in) :: a
            type(t), intent(in) :: b
            i_plus_t%val_t = b%val_t + a
        end function
        
end module mod_t

program cata_1
    use mod_t

    type(t) :: a
    integer :: b
    a%val_t = 11
    b       = 31
    b       = b + a
    print *, b
end program

I can't help but having slight doubts about your QA procedures when releasing new compiler versions.

0 Kudos
Steven_L_Intel1
Employee
385 Views

We run tens of thousands of tests, but there are infinite combinations of language usage and there are always some combinations we haven't seen before, and occasionally a fix for one problem will trigger a new one. I will add your second test program to the reported issue.

0 Kudos
Reply