[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "Illegal instruction" for most trivial of programs



On Feb 4, 6:00 pm, Brad Boyer <f...@allandria.com> wrote:
> On Mon, Feb 04, 2008 at 12:27:25PM -0800, James Kimble wrote:
> > I've got another weird thing going on here. I can't assign values
> > greater that 128 to integers. When the program reaches the statement
> > that does that I get the same "Illegal instruction" message and the
> > program exits without completing. For example if I just add a for loop
> > to the end of the above program it will only work for loop values less
> > than 128. At 128 the program will exit and give the "Illegal
> > instruction" message. What the heck is going on here?
>
> I presume you are assigning constant values into a variable? My first
> guess in that case would be that the compiler is emitting a MOVEQ
> instruction but not properly checking the limit on the immediate data
> field (an 8-bit signed quantity) against the value being assigned. This
> also implies a bug in the assembler where it just shoves the value onto
> the instruction word without masking out the higher bits. Seems like an
> unlikely bug, but stranger things have happened. If it only dies at
> exactly 128, it could be an off by one error. Have you tried going
> directly to much larger values and avoiding the specific value of 128?
>
> I would suggest trying to disassemble that part of the object file and
> see what you get. It might also be worthwhile to look at the assembly
> code generated by the compiler (add -save-temps to your gcc options).
>
>         Brad Boyer
>         f...@allandria.com
>
> --
> To UNSUBSCRIBE, email to debian-68k-REQU...@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Sorry, stupid, stupid, stupid. Been working on this for too long. I'm
getting punchy. I use a makefile for most things but I was working
with some early test code for a few things and was compiling from the
command line. Forgot to use the "-mcfv4e" compiler option. Sorry to
waste anyone's cycles on this....


Reply to: