[comp.sys.amiga.tech] Lattice C question

ewing@se-sd.SanDiego.NCR.COM (David Ewing) (05/05/90)

I am experiencing an unusual run-time error on a relatively simple 
program I wrote using Lattice C 5.04.

At the end of my program, I get a Software Error-task held window
followed by various Guru messages :

    #00000003.00C39620 -- Address Error  (usually)
    #00000004.00C39E38 -- Illegal Instruction  (occassionally)
    #0000000B.00C39628 -- Opcode 111 (once)
    
My code resides between 00C70CCC - 00C718D2, so these addresses
are outside the code itself. My program does not use any Amiga 
specific routines.  It currently just uses stdio to and from the 
shell window. 

I added the following debug statement at the end of main and it does
get printed:

main()
{
 ...
 printf("reached the end of the program\n");
}

I even tried putting an exit(1) statement as the last statement in
main, but it still gurus. There aren't even any files being
accessed !  

I realize this isn't much to go on but does anybody have any ideas ?
Note : the program conists of just one source file and one header
file compiled and linked as follows -- lc -Lm file.c.

Please email to ewing@se-sd.sandiego.ncr.com.
Thanks,
Dave Ewing

valentin@cbmvax.commodore.com (Valentin Pepelea) (05/08/90)

In article <2865@se-sd.SanDiego.NCR.COM> ewing@se-sd.SanDiego.NCR.COM
(David Ewing) writes:
>
>    #00000003.00C39620 -- Address Error  (usually)
>    #00000004.00C39E38 -- Illegal Instruction  (occassionally)
>    #0000000B.00C39628 -- Opcode 111 (once)

These GURUs indicate that your task is completely out of wack. You have runaway
code.

>My code resides between 00C70CCC - 00C718D2, so these addresses
>are outside the code itself.

The address given in the GURU number is that of the TCB (task control block),
not the address on which the error occurred.

>I added the following debug statement at the end of main and it does
>get printed:

That's real nice, but without the entire source code, it is impossible to
determine what is happening. Try commenting out source code until the 
problem disappears. You may thus locate the problem. Then post the minimal
source code which repeats the bug on Usenet. You'll get better answers.

Valentin
-- 
The Goddess of democracy? "The tyrants     Name:    Valentin Pepelea
may distroy a statue,  but they cannot     Phone:   (215) 431-9327
kill a god."                               UseNet:  cbmvax!valentin@uunet.uu.net
             - Ancient Chinese Proverb     Claimer: I not Commodore spokesman be

ewing@se-sd.SanDiego.NCR.COM (David Ewing) (05/09/90)

Thanks to all who responded about my mysterious runtime 
error in Lattice C 5.04 (guruing at end of execution).  The
majority of responders suggested it was a stray pointer or array
reference, however it turned out to be a stack overflow problem
(thanks, John Meissen).

Dave Ewing
ewing@se-sd.sandiego.ncr.com