- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As it becomes time to move from the classic compiler to the new IFX compiler, I start to use the IFX compiler. My first attempt, however, failed when calling C_F_POINTER. The compiler invites me friendly to report this internal compiler error. So here I am.
With the classic compiler I did not see this error for either this example as many other projects where I use it. I have enclosed a small example.
Robert
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just a general comment - it is helpful for others to give a more descriptive title to threads here. You could have written something like "ICE with IFX and C_F_POINTER".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can always claim an "internal compiler error" (ICE) is a bug and as pointed to you, mentioning ICE in the thread title itself can help catch the attention of Intel team.
Separately, if your interest is in an "early" implementation of the Fortran 2023 "c_f_strpointer" intrinsic module procedure, you may want to consider simplifying greatly what you are doing, avoid any unnecessary allocations, etc. Here's a snippet you can try with the new compiler, especially IFX - note I haven't tested it, it's a quick edit on a tab based on your example with my mental compiler:
module cstring_m
use, intrinsic :: iso_c_binding, only : c_char, c_size_t, c_ptr, c_f_pointer
generic :: c_f_strpointer => c_f_strpointer_cstrptr
contains
subroutine c_f_strpointer_cstrptr( cstrptr, fstrptr, nchars )
! Argument list
type(c_ptr), intent(in) :: cstrptr
character(kind=c_char, len=:), pointer, intent(out) :: fstrptr
integer(c_size_t), intent(in) :: nchars
if ( nchars >= 0 ) then
block
character(kind=c_char, len=nchars), pointer :: sptr
call c_f_pointer( cstrptr, sptr )
fstrptr => sptr
sptr => null()
end block
end if
return
end subroutine
end module
use, intrinsic :: iso_c_binding, only : c_char, c_null_char, c_loc, c_size_t
use cstring_m, only : c_f_strpointer
character(kind=c_char, len=:), allocatable, target :: s
character(kind=c_char, len=:), pointer :: ps
s = c_char_"This is a test string!" // c_null_char
call c_f_strpointer( c_loc(s), ps, nchars=22_c_size_t )
print *, "ps: ", ps
print *, "len_trim(ps) = ", len_trim(ps), "; expected is 22"
end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for sending this. The bug ID is CMPLRLLVM-43336
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank all of you for your help. As FortranFan suggests, the routine was written to have it available as soon as possible. The new standard has a series of new procedures that are very, very, welcome. The C-string helpers are one of these.
In the mean time I found some other ICE's . I will take a cl.oser look to see if these are related with the ICE here; I will let you know.
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this bug is fixed in 2023.2.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page