Aucbvax.5571 fa.unix-wizards utzoo!decvax!ucbvax!unix-wizards Sun Dec 27 01:00:49 1981 >From decvax!duke!reed!ross@Berkeley Sun Dec 27 00:47:23 1981 Can someone help me? I'm trying to trap floating underflow on the VAX in C. The way I read the "Architecture Handbook", there are two kinds of underflow events -- traps and faults (pp. 301-2). The 11/780 has the trap but not the fault. The 11/750 is the other way around ("Hardware Handbook", pp. 43-4). I have an 11/780. The trap only happens when the trap enable bit is turned on; the fault is always enabled. This much seems reasonable. Herein lies the rub: the "calls" instruction (emitted by C) turns off the trap enable bit for the called routine. DEC calls this bug a "feature," noting that the "calls" instruction thus leaves the processor in a "known state" at the beginning of the ensuing subrou- tine. I can write some as(1) code to patch the enable bit in the saved psl and return, but I'd rather not put calls to this routine all over in my program. Berkeley Pascal on my 4.?BSD diagnoses under- flows as overflows -- but at least it traps them! I'd be pretty happy just knowing how it does it. I'd be overjoyed to know how to diagnose them correctly. I don't need to recover the arguments and retry in software or anything like that. The best idea I've had yet is to compile my code for profiling and write my own mcount and mcrt0. This gives me a place (mcount) to do the grunge-work. But I'd rather find out that I'm wrong about the VAX and that it's really a nice machine after all. -Graham Ross (duke!reed!ross) ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.