This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/35634] [avr] result of char promotion comes out of CHAR_MIN/MAX
- From: "pinskia at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Mar 2008 06:10:24 -0000
- Subject: [Bug target/35634] [avr] result of char promotion comes out of CHAR_MIN/MAX
- References: <bug-35634-6291@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gmail dot com 2008-03-19 06:10 -------
Subject: Re: New: [avr] result of char promotion comes out of CHAR_MIN/MAX
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"
<gcc-bugzilla@gcc.gnu.org
> 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 <limits.h>
>
> 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
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35634