From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 773 invoked by alias); 19 Mar 2008 06:10:22 -0000 Received: (qmail 758 invoked by uid 22791); 19 Mar 2008 06:10:22 -0000 X-Spam-Check-By: sourceware.org Received: from wa-out-1112.google.com (HELO wa-out-1112.google.com) (209.85.146.179) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 19 Mar 2008 06:09:48 +0000 Received: by wa-out-1112.google.com with SMTP id m16so236516waf.20 for ; Tue, 18 Mar 2008 23:09:46 -0700 (PDT) Received: by 10.114.36.1 with SMTP id j1mr555110waj.119.1205906986486; Tue, 18 Mar 2008 23:09:46 -0700 (PDT) Received: from ?192.168.0.8? ( [38.99.84.40]) by mx.google.com with ESMTPS id j34sm37475831waf.29.2008.03.18.23.09.44 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Mar 2008 23:09:46 -0700 (PDT) References: Message-Id: <69CF58AC-A0DE-4A70-BD70-01290679B3E9@gmail.com> From: Andrew Pinski To: "gcc-bugzilla@gcc.gnu.org" In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes X-Mailer: iPhone Mail (4A102) Mime-Version: 1.0 (iPhone Mail 4A102) Subject: Re: [Bug target/35634] New: [avr] result of char promotion comes out of CHAR_MIN/MAX Content-Transfer-Encoding: 7bit Date: Wed, 19 Mar 2008 06:10:00 -0000 Cc: "gcc-bugs@gcc.gnu.org" X-IsSubscribed: yes Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-03/txt/msg01549.txt.bz2 This code is only defined if char is unsigned which it is not on avr. (It is unsigned on some targets like powerpc-Linux-gnu. Sent from my iPhone On Mar 18, 2008, at 22:42, "dmixm at marine dot febras dot ru" wrote: > /* The next program is aborted with avr-gcc 4.1.2, 4.2.3, 4.3.0: > result of char promotion comes out of CHAR_MIN/MAX. > Options: -W -Wall -Os > Know to work: > 3.3.6, 3.4.6 - good code > 4.0.4 - correct, but not the best > 4.1.2, 4.2.3, 4.3.0 - without optimization only > */ > > #include > > void abort (void); > void exit (int); > > void foo (int i) > { > static int n; > if (i < CHAR_MIN || i > CHAR_MAX) > abort (); > if (++n > 1000) > exit (0); > } > > int main () > { > char c; > for (c = 0; ; c++) foo (c); > } > > > -- > Summary: [avr] result of char promotion comes out of > CHAR_MIN/MAX > Product: gcc > Version: 4.3.0 > Status: UNCONFIRMED > Severity: normal > Priority: P3 > Component: target > AssignedTo: unassigned at gcc dot gnu dot org > ReportedBy: dmixm at marine dot febras dot ru > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35634 >