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

Runtime crash in ASSOCIATE construct with unlimited polymorphism

Harald1
New Contributor II
918 Views

Hello,

the following code crashes at runtime with ifort/ifx:

 

program p
  implicit none
  class(*), allocatable :: x(:)
  x = foo()
  call prt (x)
  deallocate (x)
  ! up to here all is fine...
  associate (var => foo())
    call prt (var)      ! <- crash here
  end associate
contains
  function foo() result(res)
    class(*), allocatable :: res(:)
    res = [42]
  end
  subroutine prt (x)
    class(*), intent(in) :: x(:)
    select type (x)
    type is (integer)
       print *, x
    class default
       stop 99
    end select
  end
end

 

I get:

 ifx intel-associate-unlim-poly.f90 -g -traceback && ./a.out 
ifx: remark #10440: Note that use of a debug option without any optimization-level option will turnoff most compiler optimizations similar to use of '-O0'
          42
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
libpthread-2.31.s  00007FF2B7937910  Unknown               Unknown  Unknown
a.out              0000000000404D58  prt                        18  intel-associate-unlim-poly.f90
a.out              00000000004049AE  p                           9  intel-associate-unlim-poly.f90
a.out              000000000040425D  Unknown               Unknown  Unknown
libc-2.31.so       00007FF2B775824D  __libc_start_main     Unknown  Unknown
a.out              000000000040418A  Unknown               Unknown  Unknown

 The code works just fine with NAG.

Thanks,

Harald

 

5 Replies
Ron_Green
Moderator
905 Views

This is an interesting testcase.  Gfortran 13.0 gets an ICE just trying to compile it.

the runtime crash by ifx is a bug.  We'll get a bug report created for this case.  Thanks @Harald1 for sending this to us.

0 Kudos
Ron_Green
Moderator
899 Views

the bug ID is CMPLRLLVM-55090


0 Kudos
Ron_Green
Moderator
670 Views

@Harald1 this bug is fixed in the 2024.1.0 compiler.  I just confirmed the fix in the released compiler.

0 Kudos
Harald1
New Contributor II
619 Views

Hmmm, it still crashes at runtime here with the exact same traceback as given in the original post:

% ifx intel-associate-unlim-poly.f90 -g -traceback -V && ./a.out 
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.

ifx: remark #10440: Note that use of a debug option without any optimization-level option will turnoff most compiler optimizations similar to use of '-O0'
 Intel(R) Fortran 24.0-1472.3
GNU ld (GNU Binutils; SUSE Linux Enterprise 15) 2.41.0.20230908-150100.7.46
          42
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
libpthread-2.31.s  00007FF0450B4910  Unknown               Unknown  Unknown
a.out              0000000000404D68  prt                        18  intel-associate-unlim-poly.f90
a.out              00000000004049BE  p                           9  intel-associate-unlim-poly.f90
a.out              000000000040426D  Unknown               Unknown  Unknown
libc-2.31.so       00007FF044ED724D  __libc_start_main     Unknown  Unknown
a.out              000000000040419A  Unknown               Unknown  Unknown

 Has it been fixed in a version newer than this?

 

0 Kudos
Barbara_P_Intel
Employee
593 Views

Ooppps! There's a typo in the "Fixed Version" field of the bug report. This one is fixed in 2024.2 that is planned for mid 2024.

Sorry for the misinformation.

 

0 Kudos
Reply