I assume the cited error message has to do with register optimization, but how on earth do I figure out what the actual problem is?
Here is the whole error output:
Compiling 'TwoHeadTest' for 'Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)'
Build Folder: file:///C:/Users/RayL/AppData/Local/Temp/VMBuilds/TwoHeadTest/mega_atmega2560/Debug
main.cpp: In function main
Error linking for board Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)
Build failed for project 'TwoHeadTest'
main.cpp: 51:1: error: unable to find a register to spill in class 'NO_REGS
main.cpp: 51:1: error: this is the insn
(insn 1010 1007 1013 53 (set (mem*: QI (post_dec:HI (reg\f:HI 32 __SP_L__)) [0 S1 A8])
(subreg*: QI (reg\f:HI 635) 1)) C:\Users\RayL\AppData\Local\Temp\VMBuilds\TwoHeadTest\mega_atmega2560\Debug\TwoHeadTest.cpp:413 1 {pushqi1}
(expr_list*: REG_ARGS_SIZE (const_int 1 [0x1])
(nil)))
main.cpp:51: confused by earlier errors, bailing out
lto-wrapper*: C:\Users\RayL\Documents\AppData\Arduino\arduino-1.8.2\hardware\tools\avr\bin\avr-gcc returned 1 exit status
ld.exe: error: lto-wrapper failed
collect2.exe*: error: ld returned 1 exit status
The source line cited in (413:1 in TwoHeadTest.cpp) contains nothing but an #endif directive, and the code compiles without error when the #if is true. Full code is attached.
Regards,
Ray L.
TwoHeadTest.ino (10.7 KB)