This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34537] ICE or wrong code for TRANSFER of constant string to character
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Dec 2007 10:57:07 -0000
- Subject: [Bug fortran/34537] ICE or wrong code for TRANSFER of constant string to character
- References: <bug-34537-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from burnus at gcc dot gnu dot org 2007-12-20 10:57 -------
at /projects/tob/gcc/gcc/fortran/simplify.c:4138
4138 result_length = source_size / result_elt_size;
Here, source_size is correctly 8, but result_elt_size == 0 instead of 1
(character(len=1)).
The following fails at run time (nothing is printed):
program main
implicit none
character(len=8) :: t
call test(t)
print *, t
contains
subroutine test(a)
character(len=*) :: a
a = transfer('Sample',a)
end subroutine test
end program main
The following ill-defined program gives another ICE:
compiler error: in gfc_interpret_character, at fortran/target-memory.c:360
(It is ill defined because the source size is smaller than the result size; cf.
PR 33037. NAG f95 prints "Intrinsic TRANSFER has partly undefined result")
program main
implicit none
character(len=8), target :: t
character(len=8), pointer :: p
p => t
call test(p)
print *, t
contains
subroutine test(a)
character(len=8),pointer :: a
a = transfer('Sample',a)
end subroutine test
end program main
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Summary|ICE (FPE) for |ICE or wrong code for
|TRANSFER('string', char_ptr)|TRANSFER of constant string
| |to character
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34537