This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33888] ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Oct 2007 09:20:40 -0000
- Subject: [Bug fortran/33888] ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg
- References: <bug-33888-15045@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pault at gcc dot gnu dot org 2007-10-25 09:20 -------
(In reply to comment #1)
For some reason, the interface mechanism in trans-expr.c is failing for this
case of an elemental function (try a constant length for my_func or to make it
non-elemental and array valued - both work fince). You can see this in the
code that the testcase produces. The internal length variable, in my_func,
'..length' is being referenced in the main program, with inevitable
consequences!
A workaround, for now, is to write a temporary, which can be allocatable if
necessary.
character(8) :: temp(4)
......snip......
temp = myfunc (indata))
call process (temp)
A tricky alternative, to make use of automatic allocation and cleanup of
allocatable components, would be
type mytype
character(8), allocatable :: c(:)
end type mytype
type(mytype) :: temp
......snip......
temp%c = myfunc (indata))
call process (temp%c)
However, this segfaults for the same reason as the original. *sigh*
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33888