[comp.unix.wizards] C bug causes double fault

zarquon@tree.UUCP (Erin Filbert) (03/19/89)

While writing a deceptively simple C program, I managed to crash the entire
system here.  The following code:

main()
{
	float x;

	printf("x = %d", x);
}

will send the system into double fault.  I am using Microport System V
Release 2 on a 286 machine (AT Clone).

Has anyone else encountered this problem?  Are there any patches for it?  
The last time this happened, restarting the system caused severe file
damage.  

Any help would be greatly appreciated.

-- 
-------------------------------------------------------------------------------
I'm sorry.  I think we might have      |           Erin M. Filbert
been better off with a slide rule.     |   
   - Zaphod Beeblebrox                 |   Path: pacbell!sactoh0!tree!zarquon

dave@viper.Lynx.MN.Org (David Messer) (03/22/89)

In article <9884@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
 >In article <244@tree.UUCP> zarquon@tree.UUCP (Erin Filbert) writes:

   { Mention that this causes the system to crash deleted by Doug Gwyn }

 >>main()
 >>{
 >>	float x;
 >>	printf("x = %d", x);
 >>}
 >
 >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.

And you will probably get a flood of responses correctly pointing out
that what you say is irrelevent.  The original message mentioned that
he "crashed the entire system" by running this program (calling it
a "double fault" rather than "double panic"; which may have misled you).
It doesn't matter that the C program has a bug, it still shouldn't
crash the operating system.

 >The reason I'm posting this is so I can include a plea not to post
 >questions like this to comp.unix.wizards.

A true wizard carefully reads the question so that he might answer the
question actually asked, rather than just say the first thing that comes
to mind.

 >  Thanks.

You are welcome.
-- 
This space                           | David Messer       dave@Lynx.MN.Org -or-
for rent.                            | Lynx Data Systems  ...!bungia!viper!dave

shocking@physiol.su.oz (Stephen Hocking) (03/29/89)

In article <2044@viper.Lynx.MN.Org>, dave@viper.Lynx.MN.Org (David Messer) writes:
< In article <9884@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
<  >In article <244@tree.UUCP> zarquon@tree.UUCP (Erin Filbert) writes:
< 
<    { Mention that this causes the system to crash deleted by Doug Gwyn }
< 
<  >>main()
<  >>{
<  >>	float x;
<  >>	printf("x = %d", x);
<  >>}
<  >
<  >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.
< 
< And you will probably get a flood of responses correctly pointing out
< that what you say is irrelevent.  The original message mentioned that
< he "crashed the entire system" by running this program (calling it
< a "double fault" rather than "double panic"; which may have misled you).
< It doesn't matter that the C program has a bug, it still shouldn't
< crash the operating system.

	Ah, the joys of running under Uport 2.4. It is listed as a bug in
the release notes, but does not seem to trouble my machine (NEC APC4 8MHz,
80287-8) at this joint, but it does kill my home one (6MHz, 80287-3). 

	AAAAAAAAAGGGGGHHHHHH!!!!!

	Stephen
------

--------
	Stephen Hocking 	ACSnet shocking@physiol.su.oz
				UUCP ...!uunet!munnari!physiol.su.oz!shocking