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

NFC: Using a parameterized derived type PARAMETER to define another PARAMETER makes ifx hang

jwmwalrus
New Contributor I
362 Views

Hi.

Defining a parameterized derived type PARAMETER, and using it to define another PARAMETER, makes ifx to Never Finish Compiling. Here's the code:

module itemmod
    use ISO_FORTRAN_ENV

    implicit none
    private
    save

    type, public :: item(ilen, k)
        integer, len :: ilen = 0
        integer, kind :: k = real32
        real(k) :: val = 0
        integer :: delta(2) = 0
    end type

    type(item(1)), parameter, public :: group1 = item(1)(1., [1, 0])
    type(item(2)), parameter, public :: group2 = item(2)(1., [0, 1])
    type(item(1)), parameter, public :: group1a = group1

contains
end module itemmod

use ISO_FORTRAN_ENV
use itemmod

implicit none

type(item(1)) :: x, v
type(item(2)) :: y, w

print*,'group1=',group1,', ilen=',group1%ilen
print*,'group2=',group2,' ilen=',group2%ilen

end

The issue is caused by line 17. Here's the output from compilation attempt:

$ ifx -V -g -O0 nfc.f90 
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.1.0 Build 20240308
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.

 Intel(R) Fortran 24.0-1472.3

The command hangs and the linking-related message is never emitted. The same thing happens when using ifort.

 

The reproducer is based upon code from this post.

3 Replies
Barbara_P_Intel
Moderator
313 Views

@jwmwalrus, thanks for reporting this. I see the same hang with both ifort and ifx. I filed a bug report, CMPLRLLVM-57820.

We'll let you know when it's fixed.

0 Kudos
Barbara_P_Intel
Moderator
313 Views

Love the new acronym, NFC! 

0 Kudos
FortranFan
Honored Contributor II
281 Views

@Barbara_P_Intel wrote:

Love the new acronym, NFC! 


@Barbara_P_Intel ,

Simply changing the order of named constants in the module makes it no big deal, NFC to NBG!

What gives?!  Is it one for the front-end team?

module itemmod
    use ISO_FORTRAN_ENV

    implicit none
    private
    save

    type, public :: item(ilen, k)
        integer, len :: ilen = 0
        integer, kind :: k = real32
        real(k) :: val = 0
        integer :: delta(2) = 0
    end type

    type(item(1)), parameter, public :: group1 = item(1)(1., [1, 0])
    type(item(1)), parameter, public :: group1a = group1  !<-- moved up a line
    type(item(2)), parameter, public :: group2 = item(2)(1., [0, 1])

contains
end module itemmod

use ISO_FORTRAN_ENV
use itemmod

implicit none

type(item(1)) :: x, v
type(item(2)) :: y, w

print*,'group1=',group1,', ilen=',group1%ilen
print*,'group2=',group2,' ilen=',group2%ilen

end
C:\temp>ifx /free /standard-semantics p.f
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.1.0 Build 20240308
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.

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

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

C:\temp>p.exe
 group1= 0.000000 1 0 , ilen= 1
 group2= 0.000000 0 1  ilen= 2
0 Kudos
Reply