This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/26038] FORTRAN segfault
- From: "eedelman at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Jan 2006 11:12:24 -0000
- Subject: [Bug fortran/26038] FORTRAN segfault
- References: <bug-26038-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #8 from eedelman at gcc dot gnu dot org 2006-01-31 11:12 -------
(In reply to comment #7)
> The original code looks like
>
> subroutine foo(self)
> character(*) :: self
> pointer :: self
> nullify(self)
> allocate(self)
> self = " "
> end subroutine
>
> Is this code valid? How can I make it valid?
I think it's valid.
(The length of 'self', which is needed at allocation, should be passed to foo
by the caller. For example, the code below should print
5
10
on execution:
-----------
module moo
contains
subroutine foo(self)
character(*) :: self
pointer :: self
nullify(self)
allocate(self)
print *, len(self)
end subroutine
end module moo
program hum
use moo
character(5), pointer :: p
character(10), pointer :: q
call foo(p)
call foo(q)
end program hum
-----------------
)
--
eedelman at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-01-31 11:12:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26038