Re: [PORTS] Patch for m68k architecture (fwd)

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Roman(dot)Hodek(at)informatik(dot)uni-erlangen(dot)de
Cc: olly(at)lfix(dot)co(dot)uk, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PORTS] Patch for m68k architecture (fwd)
Date: 1999-06-14 21:53:25
Message-ID: 199906142153.RAA16276@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Hi Bruce!
>
> > I have already asked for you to try a change to template/linux_m68k
> > by changing the optimization -O2 to -O and see if you still need the
> > postgres.h fmgr_ptr change you did. I assume you are using egcs, right?
>
> Can't remember that you asked me... But anyway, it wouldn't help. It's
> defined in the SysV/m68k ABI that %d0 is used for scalar return values
> and %a0 for pointer values. Both gcc and egcs do it like this, and
> it's also independent from optimization level. (And, BTW, I didn't use
> egcs.)
>
> This behaviour is one of the most prominent porting problems to m68k.
> ANSI C says results are undefined if you call a function via pointer
> and the pointer is declared to return another type than the function
> actually returns. So m68k compilers conform to the standard here.
> However, most programmers never expect such problems... also because
> on most architectures it works without probs, because all values are
> returned in the same register.

Yes, we admit that we break the standard with fmgr_ptr, because we
return a variety of values depending on what function they call. It
appears the egcs optimization on the powerpc or alpha cause a problem
when optimization is -O2, but not -O. We may see more platforms with
problems as optimizers get smarter.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-06-14 22:36:40 elephant picture
Previous Message Brook Milligan 1999-06-14 21:32:11 trigger functions and access to datatypes