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

Internal compiler error of ifx 2023.0.0 with iso_c_binding

Juergen_R_R
Valued Contributor I
515 Views

The following code leads to an ICE with ifx 23.0.0:

afs/desy.de/UBU/22/x86_64/opt/intel/2023/oneapi/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1b445c9]
/afs/desy.de/UBU/22/x86_64/opt/intel/2023/oneapi/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1d028ee]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7fec87d9ad90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7fec87d9ae40]
/afs/desy.de/UBU/22/x86_64/opt/intel/2023/oneapi/compiler/2023.0.0/linux/bin-llvm/xfortcom[0x1982da9]

cpp_strings_sub.f90(58): error #5623: **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.
c(i:i) = cpp_str_get (s%cptr, int (i-1, c_int))
----------------^
compilation aborted for cpp_strings_sub.f90 (code 3)

 

This is the code

module cpp_strings
  use, intrinsic :: iso_c_binding
  implicit none
  private

  type :: cpp_string_t
     private
     type(c_ptr) :: cptr = c_null_ptr
     integer :: strlen = 0
   contains
     procedure :: final => cpp_string_final
  end type cpp_string_t

  interface
     subroutine cpp_str_delete (cpp_str) bind (C)
       import
       type(c_ptr), value :: cpp_str
     end subroutine cpp_str_delete
  end interface

  interface
     function cpp_str_length (cpp_str) bind (C) result (length)
       import
       type(c_ptr), intent(in), value :: cpp_str
       integer(c_int) :: length
     end function cpp_str_length
  end interface
       
  interface
     function cpp_str_get (cpp_str, i) bind (C) result (c)
       import
       type(c_ptr), intent(in), value :: cpp_str
       integer(c_int), intent(in), value :: i
       character(c_char) :: c
     end function cpp_str_get
  end interface
contains

  subroutine cpp_string_init (s, cptr)
    class(cpp_string_t), intent(out) :: s
    type(c_ptr), intent(in) :: cptr
    s%cptr = cptr
    s%strlen = cpp_str_length (cptr)
  end subroutine cpp_string_init

  subroutine cpp_string_final (s)
    class(cpp_string_t), intent(inout) :: s
    call cpp_str_delete (s%cptr)
    s%cptr = c_null_ptr
    s%strlen = 0
  end subroutine cpp_string_final

  function char_from_cpp_string (s) result (c)
    type(cpp_string_t), intent(in) :: s
    character(len=s%strlen) :: c
    integer :: i
    do i = 1, s%strlen
       c(i:i) = cpp_str_get (s%cptr, int (i-1, c_int))
    end do
  end function char_from_cpp_string


end module cpp_strings
1 Solution
Ron_Green
Moderator
267 Views

This bug was fixed in the 2023.2 release


View solution in original post

0 Kudos
2 Replies
Ron_Green
Moderator
491 Views

Thanks for sending this to us. Bug ID is CMPLRLLVM-46333


0 Kudos
Ron_Green
Moderator
268 Views

This bug was fixed in the 2023.2 release


0 Kudos
Reply