WEIRD BUG ABOUT EXIT

Brian Mak brian at orange.ucsb.edu
Mon Jul 30 15:59:17 AEST 1990


I encounter a weird bug at the end of my program. I got a segmentation fault
right at the closing bracket of the main(). i.e. if

line 1:	main()
line 2:	{
	 .
	 .
	 .
line N:	}

the faults occurs right at line N.

But if I put exit(0) before line N, it exits without error!

The only reason I may think of is that the address holding STOP of the 
main() is somehow overwritten by the program. But does anyone of you may
think of probable reasons for that? Or does anyone has encountered such
error before?

Please reply both to me personally and to the newsgroup.

Brian MAK



More information about the Comp.lang.c mailing list