Skip to content

.Fortran interface error

2 messages · Javier Garcia-Pintado, Charlie Sharpsteen

#
Yes!!!!!!!! That's it! Thanks a lot!!!!!!
Changing UNIT=5 in the F95 code by UNIT=7 solves the collision.

Thank you very much Charlie, I've spent a lot of hours with this.

Still

R -d valgrind --vanilla < foofortran.Rcheck/foofortran-Ex.R

gives 3 errors (two "Invalid read of size 8" and one "Syscall param
write(buf) points to uninitialised byte(s)"), which are the same it gave
with UNIT=5. However, everything seems to work fine now in the normal
execution :-)

Thank you very much again

Javier
---

==25824== Memcheck, a memory error detector.
==25824== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==25824== Using LibVEX rev 1732, a library for dynamic binary translation.
==25824== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==25824== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==25824== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==25824== For more details, rerun with: -v
==25824==

R version 2.10.1 (2009-12-14)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
==25824== Invalid read of size 8
==25824==    at 0x401431B: (within /lib64/ld-2.6.1.so)
==25824==    by 0x4009631: (within /lib64/ld-2.6.1.so)
==25824==    by 0x5A9D804: (within /lib64/libc-2.6.1.so)
==25824==    by 0x57A3143: (within /lib64/libdl-2.6.1.so)
==25824==    by 0x400C8E5: (within /lib64/ld-2.6.1.so)
==25824==    by 0x57A336C: (within /lib64/libdl-2.6.1.so)
==25824==    by 0x57A30F9: dlsym (in /lib64/libdl-2.6.1.so)
==25824==    by 0x59871C: R_local_dlsym (dynload.c:216)
==25824==    by 0x4C9944: AddDLL (Rdynload.c:557)
==25824==    by 0x4CA073: do_dynload (Rdynload.c:893)
==25824==    by 0x428372: do_internal (names.c:1165)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==  Address 0x61BA068 is 16 bytes inside a block of size 18 alloc'd
==25824==    at 0x4C21D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==25824==    by 0x4C9918: AddDLL (Rdynload.c:549)
==25824==    by 0x4CA073: do_dynload (Rdynload.c:893)
==25824==    by 0x428372: do_internal (names.c:1165)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==    by 0x54F6AF: Rf_applyClosure (eval.c:699)
==25824==    by 0x54D105: Rf_eval (eval.c:508)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==    by 0x54EE71: do_set (eval.c:1502)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==    by 0x55157B: do_begin (eval.c:1245)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==
==25824== Invalid read of size 8
==25824==    at 0x4014DCE: (within /lib64/ld-2.6.1.so)
==25824==    by 0x400967A: (within /lib64/ld-2.6.1.so)
==25824==    by 0x5A9D804: (within /lib64/libc-2.6.1.so)
==25824==    by 0x57A3143: (within /lib64/libdl-2.6.1.so)
==25824==    by 0x400C8E5: (within /lib64/ld-2.6.1.so)
==25824==    by 0x57A336C: (within /lib64/libdl-2.6.1.so)
==25824==    by 0x57A30F9: dlsym (in /lib64/libdl-2.6.1.so)
==25824==    by 0x59871C: R_local_dlsym (dynload.c:216)
==25824==    by 0x4C9944: AddDLL (Rdynload.c:557)
==25824==    by 0x4CA073: do_dynload (Rdynload.c:893)
==25824==    by 0x428372: do_internal (names.c:1165)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==  Address 0x61BA068 is 16 bytes inside a block of size 18 alloc'd
==25824==    at 0x4C21D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==25824==    by 0x4C9918: AddDLL (Rdynload.c:549)
==25824==    by 0x4CA073: do_dynload (Rdynload.c:893)
==25824==    by 0x428372: do_internal (names.c:1165)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==    by 0x54F6AF: Rf_applyClosure (eval.c:699)
==25824==    by 0x54D105: Rf_eval (eval.c:508)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==    by 0x54EE71: do_set (eval.c:1502)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==    by 0x55157B: do_begin (eval.c:1245)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==
==25824== Syscall param write(buf) points to uninitialised byte(s)
==25824==    at 0x5A5DC40: write (in /lib64/libc-2.6.1.so)
==25824==    by 0x50E8000: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x50E807D: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x50E8817: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x50E545C: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x50E597B: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x50E59D8: _gfortran_st_write_done (in
/usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x849CC02: foof90_ (ofoofunc.f90:18)
==25824==    by 0x5200FD: do_dotCode (dotcode.c:1724)
==25824==    by 0x54D3AB: Rf_eval (eval.c:490)
==25824==    by 0x54EE71: do_set (eval.c:1502)
==25824==    by 0x54D1E1: Rf_eval (eval.c:464)
==25824==  Address 0x404C3D3 is 171 bytes inside a block of size 8,344
alloc'd
==25824==    at 0x4C21D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==25824==    by 0x5069D38: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x50E8269: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x50E7A73: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x5069B37: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x50F9241: (within /usr/lib64/libgfortran.so.2.0.0)
==25824==    by 0x5066CF2: (within /usr/lib64/libgfortran.so.2.0.0)
 runfile:   anystring !"#$%&'&#65533;&#65533;&#65533;&#65533;06
                                   &#65533;&#65533;&#65533;&#1075;&#65533;'


&#9618;&#9618;
orunfile:   anystring
#
jgarcia-2 wrote:
I'm glad it worked!

Google seems to indicate that units 0, 5, 6, 100, 101 and 102 are special in
Fortran.  However, the professor who taught me Fortran recommended using
unit numbers that were 11 or greater as his experience with several Fortran
compilers was that they tended to appropriate units <= 10 for their own uses
and this behavior was not well standardized.

I haven't been able to verify this myself, but there may be something to his
warning.
jgarcia-2 wrote:
I'm not well acquainted with valgrind so I can't offer any advice on this
part :(

Good luck!

-Charlie

-----
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University