This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/15204] New: ADJUSTR intrinsic accesses corrupted pointer
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Apr 2004 17:02:55 -0000
- Subject: [Bug fortran/15204] New: ADJUSTR intrinsic accesses corrupted pointer
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compile the following program with "gfortran -static -o adjustr adjustr.f90"
Then try to execute the generated binray.
program test_adjustr
implicit none
character(len=10) s1, s2
!0123456789
s1 = 'Steve'
s2 = adjustr(s1)
print*, 's1 = "', s1, '"'
print*, 'adjustr(s1) = "', s2, '"'
!0123456789
s1 = ' Steve'
s2 = adjustr(s1)
print*, 's1 = "', s1, '"'
print*, 'adjustr(s1) = "', s2, '"'
!0123456789
s1 = ' Steve'
s2 = adjustr(s1)
print*, 's1 = "', s1, '"'
print*, 'adjustr(s1) = "', s2, '"'
end program test_adjustr
kargl[262] valgrind adjustr
==14500== Memcheck, a memory error detector for x86-linux.
==14500== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward.
==14500== Using valgrind-2.1.0, a program supervision framework for x86-linux.
==14500== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward.
==14500== Estimated CPU clock rate is 1219 MHz
==14500== For more details, rerun with: -v
==14500==
==14500== Conditional jump or move depends on uninitialised value(s)
==14500== at 0x804D9EA: _gfortran_adjustr (in adjustr)
==14500== by 0x8048201: MAIN__ (adjustr.f90:20)
==14500== by 0x80484B3: main (in adjustr)
s1 = "Steve "
==14500==
==14500== Syscall param write(buf) contains uninitialised or unaddressable byte(s)
==14500== at 0x8051E53: (within adjustr)
==14500== by 0x804985C: _gfortran_next_record (in adjustr)
==14500== by 0x804A6AE: finalize_transfer (in adjustr)
==14500== by 0x804A78A: _gfortran_st_write_done (in adjustr)
==14500== Address 0x8078083 is not stack'd, malloc'd or free'd
adjustr(s1) = "@G3"
==14500==
==14500== ERROR SUMMARY: 5 errors from 3 contexts (suppressed: 0 from 0)
==14500== malloc/free: in use at exit: 0 bytes in 0 blocks.
==14500== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
Environment:
System: FreeBSD c-67-168-59-70.client.comcast.net 5.2-CURRENT FreeBSD 5.2-CURRENT #2: Sat Apr 24 10:33:08 PDT 2004 kargl@c-67-168-59-70.client.comcast.net:/usr/obj/usr/src/sys/HOTRATS i386
host: i386-unknown-freebsd5.2
build: i386-unknown-freebsd5.2
target: i386-unknown-freebsd5.2
configured with: ../gcc/configure --prefix=/home/kargl/gcc/work --disable-libmudflap --enable-languages=c,f95 --with-gmp=/usr/local
How-To-Repeat:
See above.
--
Summary: ADJUSTR intrinsic accesses corrupted pointer
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kargl at c-67-168-59-70 dot client dot comcast dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-unknown-freebsd5.2
GCC host triplet: i386-unknown-freebsd5.2
GCC target triplet: i386-unknown-freebsd5.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15204