Path: utzoo!attcan!uunet!lll-winken!ames!killer!rpp386!spdyne!root From: root@spdyne.UUCP Newsgroups: comp.unix.microport Subject: Re: C bug causes double fault Message-ID: <1700015@spdyne> Date: 22 Mar 89 22:22:00 GMT References: <244@tree.UUCP> Lines: 59 Nf-ID: #R:tree.UUCP:244:spdyne:1700015:004:2779 Nf-From: spdyne.UUCP!root Mar 22 16:22:00 1989 # gwyn@smoke.BRL.MIL writes: (Doug Gwyn) # In article <27245@cci632.UUCP> tvf@ccird7.UUCP (Tom Frauenhofer) writes: # >On Microport V/AT, what he wrote causes a kernel panic. That doesn't seem # >to be reasonable behavior for an OS/library routine/whatever. # # Of course nobody would call it "reasonable", but it's not too surprising. # Incorrect user-mode code on a nonprotected multitasking system (forced by # limitations of the PC/AT architecture) can easily crash the entire system. I Agree. # To avoid problems in the original example, the C implementation would # have to perform many detailed checks at run time, which would be considered # prohibitively high overhead. Gee, it works under DOS's Turbo C... Maybe DOS is better protected :-) :-) Seriously, all that one would have to do is to pass the floating/double args on the stack like is done for Turbo C. I presume that Uport is doing something funky and passing them thru the Floating point processer?? If they passed them on the stack, the above code would only print a screwy number. (5 or 8 bytes passed, 2 used.) I wonder how they got the parm passing messed up so bad? I can't see any way that you could be able to pass mixed floats/ints/etc without doing it on a stack, and then the code specified should work like a charm...(print junk, but work). # You'll undoubtedly get a flood of responses correctly pointing out # that conversion of a double (promoted float) argument according to # an int format is incorrect. Use %g or some such format specifier. Could be, there are some stupid people who might not think that he knew that... # The reason I'm posting this is so I can include a plea not to post # questions like this to comp.unix.wizards. That's what # comp.unix.questions is for. UNIX-WIZARDS is for "wizardly" # discussions (not that it gets very many, but that's what it's # inteded for). Thanks. I shouldn't dignify this with a response, but really Doug, don't you think that *ANY* code (esp. a very short one) that can cause a double panic is *Wizards* material???? I'm sure they guy saw what was wrong in his code! Sheesh, some people try to make others look stupid and end up looking *very* stupid themselves! Go home and flame yourself! What you say is that the *only* reason that you posted, was to flame those people who have problems and are unable to determine if it is a *Wizards* problem or an easy one. Keep in mind that there are people out there who don't know as much as you about UNIX [there must be one or two..:-)] and some of them can't determine the nature of the problem. Compiler? OS? My code? In the above case it was the OS. -Chert Pellett root@spdyne PS: I tried to send Doug mail, but smoke was not a known node...