internal compiler error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

internal compiler error

Jump to solution
792 Views
s4w2099
Contributor II

Hello, I have a little problem with an internal compiler error. As suggested by the error I sent an email to freescale about it. I decided to post the message here as well just in case anyone might have a clue. I pasted the message I sent them bellow:

 

Hello I am getting an error when trying to compile a program. The error is the following:

Error: internal compiler error (report to )
while executing in file 'Coloring.c' line 635
(compiling '_saveRegisters' in 'CerruchOS.c')
CerruchOS.c line 60

The code I am trying to compile is pasted bellow:

void saveRegisters(void)
{
unsigned int stackAddr = taskList[currentTask].stackBase;
asm {
move.l d0, -(sp)
move.w sr, d0
move.l d0, -(sp)
move.l d1, -(sp)
move.l d2, -(sp)
move.l d3, -(sp)
move.l d4, -(sp)
move.l d5, -(sp)
move.l d6, -(sp)
move.l d7, -(sp)
move.l a0, -(sp)
move.l a1, -(sp)
move.l a2, -(sp)
move.l a3, -(sp)
move.l a4, -(sp)
move.l a5, -(sp)
move.l a6, -(sp)
move.l stackAddr, a0
move.l sp, (a0)
}
}

if I comment out the last two mov.l instructions the program compiles just fine. I dont understand why this is happening. I am trying to write a very simple OS for the Coldfire MCF52259.

I am running Windows XP 32-bit Pro with CodeWarrior 7.21 classic
Relevant System Specs:
2 x Xeon L5410
8GB Ram (windows detects 3GB though)

could you please provide a fix for this issue or at least a work-arround?

Thank you

Labels (1)
0 Kudos
1 Solution
489 Views
s4w2099
Contributor II

Carlos Alberto from Technical Information replied saying this is a compiler bug and provided a workaround. He said to do somthing like this: 

 

movem.l d0-d7/a0-a6, -60(sp)

 

which works very well in a single instruction.

 

I am sorry I tried to find in the options a way to move this post out of this forum and into the Codewarrior Forum but I saw no such option. If an admin reads this and can move the post, please do.

 

Thank you

View solution in original post

0 Kudos
3 Replies
489 Views
TomE
Specialist II

You might like to post this in the CodeWarrior forum. This forum is for "information about Freescale 68000 and ColdFire MPU.".

 

It failed in "coloring.c" which implies "Register Coloring" (http://en.wikipedia.org/wiki/Global_graph_coloring_register_allocation).

 

It was trying to compile "_saveRegisters". It might be having trouble because in your code you're already USING all of the registers and it doesn't expect that!

 

There may be a way around this, but for this sort of "low level operation" you're probably better off putting all of these functions in a real assembly file rather than trying to use in-line assembly.


The compiler has "overhead" in compiling your function. It needs one or more registers to handle the local stack, local variable (stackAddr), the index calculations and the stack linkage.

 

How are you intending to swap stacks in your system when you swap from one stack to another? The compiler has an expectation of what the stack is doing that you might break.

 

Hint: See if your build environment (compiler and library) supports setjmp() and longjmp(). They should be using the data structure defined in setjmp.h. I've seen them used in a simple OS like you're working on. Where should I look for this? See if this helps:

 

http://en.wikipedia.org/wiki/Setjmp#Cooperative_multitasking

 

Tom

 

0 Kudos
489 Views
s4w2099
Contributor II

Thanks Tom,

 

I actually got the OS working for but I was not able to save ALL of the registers. This makes it somewhat slow because I have to disable the register coloring optimization.

 

I think you might have hit the nail in the head but I have some doubts. In my restore context function an am actually popping all the "saved" register values out of the stack and it compiles OK.

 

Lets wait and see if the support team has anything to say about this.

0 Kudos
490 Views
s4w2099
Contributor II

Carlos Alberto from Technical Information replied saying this is a compiler bug and provided a workaround. He said to do somthing like this: 

 

movem.l d0-d7/a0-a6, -60(sp)

 

which works very well in a single instruction.

 

I am sorry I tried to find in the options a way to move this post out of this forum and into the Codewarrior Forum but I saw no such option. If an admin reads this and can move the post, please do.

 

Thank you

0 Kudos