To all and sundry, near and far,
Ivan Krylov in particular ....
(The latter being singled out because he was so helpful the last time I
asked a question on this issue. My apologies to him if I am being a
pest.)
I have again been beset by a "stack smashing" problem when trying
to run R code that calls upon dynamically loaded Fortran. I have now
reached the end of my limited mental resources in trying to solve this
problem, so I am beseeching R-help to come to my assistance.
I have applied valgrind to try to track down the source of the problem.
I.e. I started R using "R -d valgrind". The output from trying to run
my code is in the attached file "vgo.txt". All that I can discern from
this output is that something went wrong. The "location" of the
problem seems to be specified as line 85 in the Fortran file "getgl.f",
but this is the last line ("end") of that file, so this just seems to be
saying that there is something wrong, somewhere in this file!
I have bundled up all of the components of a reproducible example in a
"shell archive" that I have named "shark.txt" (which is attached). To
investigate the problem:
* unpack the shell archive using "sh shark.txt"
* create a shared object library using "R CMD SHLIB -o hah.so *.f"
* start R using "R -d valgrind"
* source the file "scr" (from the archive) using 'source("scr")'
The shell archive concept is peculiar to Unix/Linux, but apparently
there is an application called "ZipZag" which can be used by Windoze
users to unpack shell archives (if any such users are interested).
I have gone over and over my code, to the point of madness, looking for
argument miss-matches in the calls in this code, and for screw-ups in
the dimension statements, and can find none. They must be there
somewhere, but I cannot see them. Can anyone help me?
Note that the code in the *.f files is very opaque, since the code was
originally written in Ratfor and then compiled into Fortran. The Ratfor
code is much more perspicuous, so I have included the corresponding *.r
files so as to possibly provide some enlightenment. If you have ratfor
on your system, you can do things like "ratfor getgl.r > getgl.f" to
recreate the *.f files.
Thanks for any assistance.
cheers,
Rolf Turner
--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
*** stack smashing detected ***: terminated
==194844==
==194844== Process terminating with default action of signal 6 (SIGABRT)
==194844== at 0x4F8503B: raise (raise.c:51)
==194844== by 0x4F64858: abort (abort.c:79)
==194844== by 0x4FCF29D: __libc_message (libc_fatal.c:155)
==194844== by 0x5071AE9: __fortify_fail (fortify_fail.c:26)
==194844== by 0x5071AB5: __stack_chk_fail (stack_chk_fail.c:24)
==194844== by 0x16E0E8B3: getgl_ (getgl.f:85)
==194844==
==194844== HEAP SUMMARY:
==194844== in use at exit: 269,070,342 bytes in 26,449 blocks
==194844== total heap usage: 88,766 allocs, 62,317 frees, 477,984,012 bytes
allocated
==194844==
==194844== LEAK SUMMARY:
==194844== definitely lost: 0 bytes in 0 blocks
==194844== indirectly lost: 0 bytes in 0 blocks
==194844== possibly lost: 0 bytes in 0 blocks
==194844== still reachable: 269,070,342 bytes in 26,449 blocks
==194844== of which reachable via heuristic:
==194844== newarray : 4,264 bytes in 1 blocks
==194844== suppressed: 0 bytes in 0 blocks
==194844== Rerun with --leak-check=full to see details of leaked memory
==194844==
==194844== For lists of detected and suppressed errors, rerun with: -s
==194844== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Abort (core dumped)
--- Begin Message ---
====================================================
We removed a file from this message
====================================================
Your organization's email policy doesn't permit this type of file. If you need
it, please
contact your administrator.
–––––––––––––––––––––––––––––––––––––––––––––––––––
File Details
Filename: shark.txt
Size: 1498542 bytes
–––––––––––––––––––––––––––––––––––––––––––––––––––
Powered by Mimecast
© 2003 - 2019 Mimecast Services Limited.
--- End Message ---
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.