This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: target/10733: Modulus bug


The following reply was made to PR target/10733; it has been noted by GNATS.

From: John Bright <jbright@winfordeng.com>
To: Dara Hazeghi <dhazeghi@yahoo.com>, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: target/10733: Modulus bug
Date: Sat, 10 May 2003 17:16:49 -0400

 Ok, a complete example where the value is obtained by writing to one of
 the AVR's ports:
 --------- test.c -------------
 #include <io.h>
 #include <io8535.h>
 
 int main(void)
 {
         unsigned char t1;
         t1=2;
         t1=(t1+40)%30;
 
         outp(0xff, DDRB);
         outp(t1, PORTB);
 
         return(0);
 }
 ------------------------------
 compile:
 avr-gcc -g -Os -Wall -Wstrict-prototypes -mmcu=at90s8535 test.c
 
 I'm assuming you want the assembly generated with avr-gcc -S and just
 the section beginning with main:
 main:
         .stabn 68,0,5,.LM1-main
 .LM1:
 /* prologue: frame size=0 */
         ldi r28,lo8(__stack - 0)
         ldi r29,hi8(__stack - 0)
         out __SP_H__,r29
         out __SP_L__,r28
 /* prologue end (size=4) */
 .LBB2:
         .stabn 68,0,8,.LM2-main
 .LM2:
         ldi r24,lo8(42)
         ldi r25,hi8(42)
         ldi r22,lo8(30)
         ldi r23,hi8(30)
         rcall __divmodhi4
         mov r25,r24
         .stabn 68,0,10,.LM3-main
 .LM3:
         ldi r24,lo8(-1)
 /* #APP */
         out 23,r24
         .stabn 68,0,11,.LM4-main
 .LM4:
         out 27,r25
         .stabn 68,0,13,.LM5-main
 .LM5:
 /* #NOAPP */
 .LBE2:
         .stabn 68,0,14,.LM6-main
 .LM6:
         ldi r24,lo8(0)
         ldi r25,hi8(0)
 /* epilogue: frame size=0 */
 
 I'm afraid I don't know what the correct assembly should be.  Does it
 appear that __divmodhi4 is not behaving correctly?
 
 
 Thanks,
 John Bright
 
 
 
 
 Dara Hazeghi wrote:
 > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-
 > trail&database=gcc&pr=10733
 > 
 > Hello,
 > 
 > would it be possible for you to give include a copy of the bad assembly
 > generated (as well as what it should be)? Also your sample is not
 > complete (ie won't compile at all). Could you include a complete
 > sample? Thanks,
 > 
 > Dara


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]