[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Bug found in __mulhi3 - was Is this possibly a bug in avr
[avr-gcc-list] Bug found in __mulhi3 - was Is this possibly a bug in avr-gcc ?
Mon, 26 Mar 2001 16:19:04 +0100
I believe i have found a bug in code generated by avr-gcc.
The error is in a function called __mulhi3.
The bug occurs when the function is called with the paramaters :-
register R22 = 0x18
register R23 = 0x00
register R24 = 0x01
register R25 = 0x02
ie, the function is performing 0x201 * 0x18
The returned value is 0x18 instead of 0x3018 and is therefore incorrect.
The code generated for the function __mulhi3 is as follows :-
+00000F0F: 2755 CLR R21
+00000F10: 2744 CLR R20
+00000F11: FF80 SBRS R24,0
+00000F12: C002 RJMP +0x0002 ; Destination: 0x000F15
+00000F13: 0F46 ADD R20,R22
+00000F14: 1F57 ADC R21,R23
+00000F15: 0F66 ADD R22,R22
+00000F16: 1F77 ADC R23,R23
+00000F17: 0561 CPC R22,R1
+00000F18: F021 BREQ +0x04 ; Destination: 0x000F1D
+00000F19: 9596 LSR R25
+00000F1A: 9587 ROR R24
+00000F1B: 0591 CPC R25,R1
+00000F1C: F7A1 BRNE -0x0C ; Destination: 0x000F11
+00000F1D: 2F95 MOV R25,R21
+00000F1E: 2F84 MOV R24,R20
+00000F1F: 9508 RET
I have no idea where the source to this function is located, but i'm sure
some of you do !
Again, I am using the following build of avr-gcc :-
Reading specs from C:\AVRGCC\BIN\..\lib\gcc-lib\avr\2.97\specs
./configure --prefix=/avrgcc --exec-prefix=/avrgcc --with-ggc=simple --enabl
included-gettext --with-gc=simple --target=avr --host=i386-mingw32 --build=i
gcc version 2.97 20010108 (experimental)
Is this known ?
Any more information that you good folks would like ?
- [avr-gcc-list] Bug found in __mulhi3 - was Is this possibly a bug in avr-gcc ?,
Lee Mitchell <=