linux-mips
[Top] [All Lists]

Re: load/store address overflow on binutils 2.14

To: Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>
Subject: Re: load/store address overflow on binutils 2.14
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Mon, 11 Aug 2003 22:58:13 +0200 (MEST)
Cc: Chip Coldwell <coldwell@frank.harvard.edu>, Linux/MIPS Development <linux-mips@linux-mips.org>
In-reply-to: <20030810145425.GE22977@rembrandt.csv.ica.uni-stuttgart.de>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
On Sun, 10 Aug 2003, Thiemo Seufer wrote:
> Chip Coldwell wrote:
> [snip]
> > >         printf("%016x\n", ~a);
> > > 
> > >         return 0;
> > > }
> > > 
> > > outputs
> > > 
> > > 00000000ffffffff
> > > 
> > > on my i386-linux system.
> > 
> > Strangely, this is actually "correct" behavior.  Arguments on
> > variable-length argument lists are implicitly "promoted" to unsigned
> > int at the widest.  See K&R 2nd ed. A6.1 and A7.3.2.
> 
> Ugh. Thanks for pointing this out. I wasn't aware of it.
> 
>       printf("%016Lx\n", ~a);
> 
> Produces the expected output. So it is actually an implementation
> bug in binutils, which isn't fixable for 2.14 and earlier, because
> those have to remain at K&R C level. The K&R requirement was only
> recenly loosened.

How can it print the correct output if ~a is `promoted' to unsigned int, while
you specify %Lx in the format string?

Gr{oetje,eeting}s,

                                                Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                                            -- Linus Torvalds


<Prev in Thread] Current Thread [Next in Thread>