anselm@castle.ed.ac.uk (A Lingnau) (08/22/90)
The following problem completely beats me. I'm also rather new to SPARCstations, and my knowledge of SPARC assembly language (ugh) is virtually zero: I have a large program (object size ~1/2 MB) that wants to read and write things from/to files. However, whenever it tries to do so a segmentation fault occurs. I have traced the error to a routine called `_doprnt()' which appears to be a subroutine of `fprintf()'. Specifically, the error occurs at the instruction _doprnt+0x24: ld [%o0], %o0 where, it seems, the machine wants to dereference a NULL pointer; at least %o0 is 0 at that point. The problem does not occur when the program in question is small (~25 KB). Also, when I substitute `fputs()' for `fprintf()' at this point, it goes past there O.K. but bombs when it hits a `fscanf()' later on. When I use `sprintf()' and `fputs()' in place of `fprintf()' the thing dies, too. The code is known to work on other UNIX machines; we're running SunOS 4.1 on a SPARCstation 1+ and the `native' C compiler. Any help will be greatly appreciated. Please email to anselm@castle.ed.ac.uk. - Anselm.