Avr-gcc 4.3.0 optimization bug

I noticed that avr-gcc 4.3.0, which is the version currently distributed by ubuntu, has an optimization bug affecting the pololu library routine that prints an integer on the screen, if you compile the library yourself. The symptom is that numbers larger than 9 are displayed with some of the digits being replaced by other ascii characters. The fix is to download, compile, and install gcc version 4.3.2, and then to recompile libpololu. Another fix is to compile the library without optimization. (The usual flag is -Os, which optimizes for space.)

1 Like