From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26270 invoked by alias); 10 May 2003 21:26:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 26169 invoked by uid 71); 10 May 2003 21:26:01 -0000 Date: Sat, 10 May 2003 21:26:00 -0000 Message-ID: <20030510212601.26167.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: John Bright Subject: Re: target/10733: Modulus bug Reply-To: John Bright X-SW-Source: 2003-05/txt/msg01003.txt.bz2 List-Id: The following reply was made to PR target/10733; it has been noted by GNATS. From: John Bright To: Dara Hazeghi , 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 #include 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