public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47042] New: ICE with character pointer in function
@ 2010-12-22 14:02 jvdelisle at gcc dot gnu.org
  2011-01-29 16:16 ` [Bug fortran/47042] " dominiq at lps dot ens.fr
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-12-22 14:02 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-02-02 18:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-22 14:02 [Bug fortran/47042] New: ICE with character pointer in function jvdelisle at gcc dot gnu.org
2011-01-29 16:16 ` [Bug fortran/47042] " dominiq at lps dot ens.fr
2011-01-29 17:37 ` burnus at gcc dot gnu.org
2011-01-30 18:21 ` burnus at gcc dot gnu.org
2011-01-30 18:22 ` burnus at gcc dot gnu.org
2011-01-30 19:02 ` burnus at gcc dot gnu.org
2011-01-30 19:03 ` burnus at gcc dot gnu.org
2011-01-30 19:24 ` burnus at gcc dot gnu.org
2011-02-02 18:18 ` dnovillo at gcc dot gnu.org
2011-02-02 18:23 ` dnovillo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).