[net.micro.mac] System Error 02 ???

gcc@ssc-vax.UUCP (Greg C Croasdill) (01/14/86)

*** REPLACE THIS LINE WITH YOUR MaSSAGE ***

g'Day,
	I'd like some help.  My Mac seems to be a very cranky critter. The only
compiled language I have for it is the Public domain version of Modula-2.  I
got this from another person here at work who has been doing development with
his copy.  My problem is that when I finish compiling and linking an application
and then try to use the result,  I consistantly get a system error 02.  I'd like
to know what is wrong  - am I not using the compiler right or is there something
wrong with my Mac? 

My setup is a 2 drive, 512K system. 
I have run multiple memory tests and they all come back saying that there is no 
problem.
The person who I got this from has had no problems with his.
The compiler and linker both finish and produce no errors (on the example progams)

I'll be >more than happy< to answer any other diagnostic questions you may
have.

				Thanks in advance,
				Greg Croasdill
				(uw-beaver|fluke)!ssc-vax!gcc



		Sorry, there has been a serious system error.

		RESTART  resume				id=02

briand@tekig4.UUCP (Brian Diehm) (01/15/86)

>and then try to use the result,  I consistantly get a system error 02.

This error results from a request to access a word or long word that is not on
an even-byte boundary.  If you have a word pointer, or a long pointer, that
ever has an odd number in it, then using that pointer will get you error 02.
This comes directly from the 68000.

As you can see from the nature of the problem, this could be ANYWHERE in what
you are trying to do!

-Brian Diehm
Tektronix, Inc.

gjs@k.cs.cmu.edu (Gregory Stein) (01/17/86)

    A system error 2 is the Mac reporting an address error. (It
can't recover from this, so it bombs.)  This is usually caused by
problems with pointers.  Say, for example, you have a pointer
to an integer.  When you get the value of the integer by saying
something like my_ptr^, the Mac will return the integer at the
address in the pointer variable my_ptr.  Now, the problem occurs
when this address has an odd value.  The 68000 can only retrieve
the integer value from an even address.  The same sort of thing
occurs for long integers -- they must have an even address, too.
So, what happened is that somewhere in your program an attempt
was made to get an integer or long integer value from an odd
address.
    I can't see the Modula 2 compiler generating code to do
this, so my best guess is that you did some sort of call to
the resource manager to get a resource (this includes things
such as GetNewDialog and GetNewWindow) but the resource wasn't
there.  In this case, the GetResource call will return a handle
containing 0.  When a routine attempts to use this handle it
looks at address 0 for another address.  This address is most
likely odd in your case, so the Mac crashes.
    My suggestion would be to look for calls that return handles
and put a test for a nil handle after the call.

			Greg Stein
			..!ucbvax!gjs@k.cs.cmu.edu

These dumb signature lines -- why do we do it?
	A communist plot to weed out comedians.