unable to find a register to spill in class 'POINT

Hey Guys,
I'm working on a gcode interpreter for the arduino and also making a library so it can be a controller for a 3axis cnc machine. I have some code and am getting an odd error that I've never seen. Here's the error message I'm getting.

CNC3AXIS.cpp: In member function 'void CNC3AXIS::moveToPosUnits(float, float, float)':
CNC3AXIS.cpp:276: error: unable to find a register to spill in class 'POINTER_REGS'
CNC3AXIS.cpp:276: error: this is the insn:
(insn 29 27 30 0 CNC3AXIS.cpp:268 (set (mem/s:SF (post_inc:HI (reg/f:HI 10 r10 [orig:41 this ] [41])) [4 <variable>.y_move_to_pos_units+0 S4 A8])
        (reg/v:SF 43 [ ypos ])) 15 {*movsf} (insn_list:REG_DEP_TRUE 5 (insn_list:REG_DEP_TRUE 28 (nil)))
    (expr_list:REG_INC (reg/f:HI 10 r10 [orig:41 this ] [41])
        (nil)))
CNC3AXIS.cpp:276: confused by earlier errors, bailing out

Now I've found a line that if I comment i won't get that error anymore but it's not making sense to me why its happening.

void CNC3AXIS::moveToPosUnits( float xpos, float ypos, float zpos )
{
    x_move_to_pos_units = xpos;
    x_move_to_pos_steps = (long)(steps_per_unit * xpos);
    y_move_to_pos_units = ypos;
    y_move_to_pos_steps = (long)(steps_per_unit * ypos);
    z_move_to_pos_units = zpos;
    z_move_to_pos_steps = (long)(steps_per_unit * zpos);

    moveUnits( (x_move_to_pos_units - x_cur_pos_units),
               (y_move_to_pos_units - y_cur_pos_units),
               (z_move_to_pos_units - z_cur_pos_units) );
}

It's this line that causes the error to show up. If I comment it there's no problem.

x_move_to_pos_steps = (long)(steps_per_unit * xpos);

Thanks for any help!

Blair

I wonder if you have a control character in your file, or there is a problem in code you have not included. The code below compiled ok for me ( I had to guess at some of the types)

float x_move_to_pos_units;
float y_move_to_pos_units;
float z_move_to_pos_units;

long x_move_to_pos_steps;
long y_move_to_pos_steps;
long z_move_to_pos_steps;

float x_cur_pos_units;
float y_cur_pos_units;
float z_cur_pos_units;

long steps_per_unit = 1;

void  moveUnits( float xpos, float ypos, float zpos ){
  
}
               
void moveToPosUnits( float xpos, float ypos, float zpos )
{
    x_move_to_pos_units = xpos;
    x_move_to_pos_steps = (long)(steps_per_unit * xpos);
    y_move_to_pos_units = ypos;
    y_move_to_pos_steps = (long)(steps_per_unit * ypos);
    z_move_to_pos_units = zpos;
    z_move_to_pos_steps = (long)(steps_per_unit * zpos);

    moveUnits( (x_move_to_pos_units - x_cur_pos_units),
               (y_move_to_pos_units - y_cur_pos_units),
               (z_move_to_pos_units - z_cur_pos_units) );
}

Its really quite odd because I have another function that is almost identical same variables and everything. The only difference is instead of multiplication its division and it has no problems.

You must have been right about the special character thing. I just rearranged the code and I'm not have any error messages now. Is there a way to see those special characters?

Heres the code now and it works fine.

void CNC3AXIS::moveToPosUnits( float xpos, float ypos, float zpos )
{
    x_move_to_pos_units = xpos;
    y_move_to_pos_units = ypos;
    z_move_to_pos_units = zpos;
    x_move_to_pos_steps = (long)(steps_per_unit * xpos);
    y_move_to_pos_steps = (long)(steps_per_unit * ypos);
    z_move_to_pos_steps = (long)(steps_per_unit * zpos);

    moveUnits( (x_move_to_pos_units - x_cur_pos_units),
               (y_move_to_pos_units - y_cur_pos_units),
                   (z_move_to_pos_units - z_cur_pos_units) );
}

Good to hear you got it going.

Sometimes a weird error message like “unable to find a register to spill in class 'POINTER_REGS'
Is a good indication that the compiler has gotten particularly confused :wink:

I have resorted to a hex editor once or twice when I have had a similar problem that I couldn't track down.

Speaking of weird error messages, my favorite error message of all time was:
“The world is coming to an end on device number 3” when I was programming a Datapoint 2200 back in the 70's. That was the only time I ever started laughing when discovering a bug in my code.