Re: Another bug in ARAnyM?
On Sat, 22 Dec 2007, Sergei Golovan wrote:
> On 12/22/07, Wouter Verhelst <email@example.com> wrote:
> > On Sat, Dec 22, 2007 at 11:34:08AM +0300, Sergei Golovan wrote:
> > > Is this a bug in ARAnyM or it is a difference between m68k and other
> > > architectures?
> > This is definately not a bug in ARAnyM.
> > On m68k, there are three sets of registers: the address registers (A0
> > through A7), the data registers (D0 through D7), and the floating
> > point registers (FP0 through FP7). The m68k ABI specifies that floating
> > point return values should be stored in FP0, that integer return values
> > should be stored in D0 (or split across D0 and D1 if it's a 64-bit
> > value), and that pointers should be stored in A0.
> > Your f() function returns a 32bit integer value, so it stores it in D0.
> > However, your main() function thinks f() returns a pointer, so will look
> > for a return value in A0. A0 does not have the value you're looking for,
> > but something entirely different (it happens to be a constant value,
> > probably some bits in libc use A0 at some point during its process
> > initialization bits).
> OK. Thanks for the info!
> > In short, your code is doing stuff it shouldn't be doing.
> I know that the code is incorrect. Though m68k seems to be the only
> architecture where it doesn't work. I'm not sure I'll convince
> upstream to rewrite the broken part (Erlang is hardly ever used on
> m68k), but I'll certainly report this as a bug.
It's indeed a bug the compiler would complain about if you had prototypes in a
common header file.
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- firstname.lastname@example.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