http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57931
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Target| |avr
Status|UNCONFIRMED |RESOLVED
CC| |gjl at gcc dot gnu.org
Resolution|--- |WORKSFORME
Build|avr |
--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Newest "WinAVR" is avr-gcc 4.3.3 and thus is pretty much outdated.
I cannot confirm this with 4.8 where the generated code (after adding #include
<stdint> to the source) reads:
$ avr-gcc foo.c -mmcu=attiny85 -Os -std=gnu99 -S
median:
/* prologue: function */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
cp r24,r22
cpc r25,r23
brge .L2
cp r24,r20
cpc r25,r21
brge .L3
movw r24,r22
rjmp .L10
.L2:
cp r22,r20
cpc r23,r21
brge .L7
.L10:
cp r20,r24
cpc r21,r25
brge .L3
movw r24,r20
ret
.L7:
movw r24,r22
.L3:
ret