[comp.sys.amiga.tech] First bug in Manx 5.0?

barrett@jhunix.HCF.JHU.EDU (Dan Barrett) (02/06/90)

	I believe I've found the first bug in Manx C 5.0a (unless somebody
has beaten me to it :-)).  Could someone please verify this for me?

Compile this simple program with the default "cc" and "ln" commands:

		1> cc bug.c
		1> ln bug.o -lc

#include <stdio.h>

main()
{
	getchar();
}

Now run the program "bug", and type ^\ (end of file) as the first character
of input.  I get the following message printed on my screen:

		Unable to load bug:  Error 2220548

As far as I can tell, this happens whenever getchar() or getc() or fgetc()
reaches EOF.  It also happens with Manx's supplied "du" utility if you press
^C while it is running.

I have a call pending at Manx.

                                                        Dan

 //////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
| Dan Barrett, Department of Computer Science          Baltimore, MD  21218 |
| INTERNET:   barrett@cs.jhu.edu           |                                |
| COMPUSERVE: >internet:barrett@cs.jhu.edu | UUCP:   barrett@jhunix.UUCP    |
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////

dlarson@blake.acs.washington.edu (Dale Larson) (02/06/90)

Unless you really want to spend your money on phone calls, or wait for
letters, you can get email to Mike Spille at Manx on CIS.  The address
is:
		71545.1466@compuserve.com

In spite of having been a beta tester three or four months, I am still
waiting for my copy of 5.0.  Grrr!!!
-- 
	There are two ways to improve on human factors in computing:
     Make the programmers less stupid and/or make the users less stupid.  
		  Both are necessary, neither are likely.
	  -Digital Teddy Bear (dlarson@blake.acs.washington.edu)

a464@mindlink.UUCP (Bruce Dawson) (02/07/90)

     The 'unable to load bug:  Error 2220548' message is, I believe, an error
in the shell, not in bug.  What happens is that (if memory serves) if a
programs returns a negative error code, the CLI says it was unable to load the
program (never mind that the program was already loaded and executed).  So, all
that is happening is that readchar() (or whatever routine it was you were
calling) is leaving a negative number in D0, which is getting returned from
main(), and there you have it.

.Bruce.

aduncan@rhea.trl.oz.au (Allan Duncan) (02/13/90)

> 
>      The 'unable to load bug:  Error 2220548' message is, I believe, an error
> in the shell, not in bug.  What happens is that (if memory serves) if a
> programs returns a negative error code, the CLI says it was unable to load the
> program (never mind that the program was already loaded and executed).  So, all
> that is happening is that readchar() (or whatever routine it was you were
> calling) is leaving a negative number in D0, which is getting returned from
> main(), and there you have it.
>

I presume that readchar() is like the rest of them and returns -1 on
EOF.  However, this value should not be passed on to the return from
main - falling off the end is equivalent to exit(0).
I would look at the source for _main() and crt0.a
 
Allan Duncan	ACSnet	aduncan@rhea.trl.oz
		ARPA	aduncan%rhea.trl.oz.au@uunet.uu.net
		UUCP	{uunet,hplabs,ukc}!munnari!rhea.trl.oz.au!aduncan
Telecom Research Labs, PO Box 249, Clayton, Victoria, 3168, Australia.
Allan Duncan	ACSnet	aduncan@rhea.trl.oz
		ARPA	aduncan%rhea.trl.oz.au@uunet.uu.net
		UUCP	{uunet,hplabs,ukc}!munnari!rhea.trl.oz.au!aduncan
Telecom Research Labs, PO Box 249, Clayton, Victoria, 3168, Australia.