This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47042] New: ICE with character pointer in function
- From: "jvdelisle at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 22 Dec 2010 14:02:33 +0000
- Subject: [Bug fortran/47042] New: ICE with character pointer in function
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47042
Summary: ICE with character pointer in function
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jvdelisle@gcc.gnu.org
I am not sure this is valid code, but it gives and ICE. There is no ICE if the
ptmp pointer is removed or the function is compiled outside the program block.
program bug
contains
function get_cstring (c_str, maxlen, c_term_char)
use iso_c_binding, only: c_ptr, c_char, c_null_char
character(kind=c_char, len=maxlen) :: get_cstring
character(kind=c_char,len=1), optional :: c_term_char
character(kind=c_char), pointer :: ptmp
type(c_ptr) :: c_str
integer :: i, maxlen
call c_f_pointer (c_str, ptmp)
do i=1,maxlen
get_cstring(i:i) = ptmp(i)
if (ptmp(i) == c_null_char) goto 10
if (present(c_term_char).and.ptmp(i) == c_term_char) goto 10
end do
return
10 continue
end function
end program