Compiler Error

Hi,

I am new to Arduino, Getting Following Error. Seeking Help to resolve!

Regards,

Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp: In function 'main':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: unable to find a register to spill in class 'NO_REGS'

}

^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: this is the insn:

(insn 929 926 932 62 (set (mem:QI (post_dec:HI (reg/f:HI 32 SP_L)) [0 S1 A8])

(subreg:QI (reg/f:HI 853) 1)) C:\Users\Abhijeet\Desktop\Modified_Panorama_Equipment_Control_Final_Program_with_XY_Remot\Modified_Panorama_Equipment_Control_Final_Program_with_XY_Remot.ino:316 1 {pushqi1}

(expr_list:REG_ARGS_SIZE (const_int 7 [0x7])

(nil)))

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51: confused by earlier errors, bailing out

lto-wrapper: C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Do a search :wink: It seems to be a compiler bug and there are workarounds (to my knowledge) but you might have to dig a little; maybe user @pert has the knowledge at hand.

It's a compiler bug.

You will find a workaround described here:

Specifically its a bug in the register-allocation section of the code-generator - the part that allocates
variables to slots in the stack frame or machine registers. "Spilling" is the act of moving a register
value to the stack frame. The compiler is trying to free up a register for another variable and failing.
Its almost certainly trying to do heavy optimization of register use.

You could try changing the compiler options to reduce the level of optimization attempted by the
compiler.

Another way which usually works is simplify the expression which is causing the problem by breaking it up into two or more separate statements. If that doesn't help then move those statements into a separate function. See these two threads for a discussion about it.
https://forum.arduino.cc/index.php?topic=510473.0
https://forum.arduino.cc/index.php?topic=397909.0

Post your code in code tags.

Pete