declaration of static function corrupts main function
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-avr (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: gcc-avr
Hi,
gcc-Version 4.3.5 (GCC), AMD64 default Maverick package.
The attached source file (see also the preprocessed input) yields corrupted machine code:
The short example "control_unit.c" contains a single for(i=0; i<6; i++)-loop that is supposed to run exactly six times.
Instead, the compiler produces a loop with undetermined behaviour that runs tens of times at least.
I compiled with the following command line for target ATTiny26:
avr-gcc -v -save-temps -c -std=c99 -g -Os -Wall -Wstrict-prototypes -Wextra -Wa,-ahlms=
I've also attached the messages displayed during the above compile run in the file "stdout-
That file also contains the GCC options with which GCC for the AVR target was configured.
Regards,
Ulrich
Amendment 1: If the source file is modified as in this attachement, the error is gone, and the compiled result works as expected.
What was changed: the function "owioReceiveWord()" is /not/ declared static in this case.
Attachement: control_ unit.WORKS. c