mjs@hpfcso.hp.com (Marc Sabatella) (02/08/90)
We have recently been porting some code around and have run into some problems related to shared libraries. What happened is that there were some uninitialized variables used by the code, and these variables usually "happened" to be zero, since the stack normally starts out clean. But when we started using shared libraries, we found that the dynamic linker was leaving garbage on the stack. We have fixed the instances we have found, but we are wondering if anyone else has found this to be a problem, or if anyone has run into any other problems where code that used to work stopped working due to shared libraries (such as the warnings given in the manual about dynamic vs. static binding semantics). Marc Sabatella marc@hpmonk.hp.com
gandalf@csli.stanford.edu (Juergen Wagner) (02/09/90)
Hmmm... Don't rely on such things as local variables being zero-initialized. Otherwise, you'll wind up with mysterious errors on some machines. As for shared libraries, the only problem I encountered is with programs like TeX/LaTeX or GNUEmacs, which dump a core image to be read in again later when the actual program is started. I also encountered some strange "Segmentation faults" with some of my (dynamically linked) programs, which go away if I use -Bstatic. However, I am not sure whether these bugs are due to bugs in the libraries or the library handling, or whether the bugs are in my programs... Juergen Wagner gandalf@csli.stanford.edu
dan@uunet.uu.net (Dan Mick) (02/14/90)
In article <4892@brazos.Rice.edu> gandalf@csli.stanford.edu (Juergen Wagner) writes: >X-Sun-Spots-Digest: Volume 9, Issue 40, message 1 > >Hmmm... Don't rely on such things as local variables being >zero-initialized. Otherwise, you'll wind up with mysterious errors on >some machines. I don't know of *any* machine that assures that local (automatic, stack) variables are 0! You may get lucky on VM machines if that's the first time you've called down that far on the stack, but it's just chance, and it sure won't be a "benevolent side-effect" on anything like a Sun-4, which puts most or all of its automatics in registers... Shudder! Autos *must* be initialized. Always.