From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6577 invoked by alias); 10 May 2003 15:36:01 -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 6518 invoked by uid 71); 10 May 2003 15:36:00 -0000 Resent-Date: 10 May 2003 15:36:00 -0000 Resent-Message-ID: <20030510153600.6516.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, jbright@winfordeng.com Received: (qmail 17263 invoked by uid 48); 10 May 2003 15:28:45 -0000 Message-Id: <20030510152845.17262.qmail@sources.redhat.com> Date: Sat, 10 May 2003 15:36:00 -0000 From: jbright@winfordeng.com Reply-To: jbright@winfordeng.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: target/10733: Modulus bug X-SW-Source: 2003-05/txt/msg00967.txt.bz2 List-Id: >Number: 10733 >Category: target >Synopsis: Modulus bug >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Sat May 10 15:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: John Bright >Release: avr-gcc (GCC) 3.2.3 20030221 (Debian prerelease) >Organization: >Environment: Linux host system, AVR cross-compiler for Atmel AT90S8535 >Description: C Source code: -------------------------------- int t1; t1=2; t1=(t1+40)%30; -------------------------------- This results in t1 having a value of 42. Compile options: avr-gcc -g -Os -Wall -Wstrict-prototypes -mmcu=at90s8535 I found this bug while using avr-gcc 3.0.3 (in Debian stable). I tried out with 3.2.3 and the same bug still exists. >How-To-Repeat: >Fix: In the above example, the bug can be worked-around by doing the modulus separately: t1=2; t1=t1+40; t1%=30; >Release-Note: >Audit-Trail: >Unformatted: