Re: [PORTS] Patch for m68k architecture (fwd) - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [PORTS] Patch for m68k architecture (fwd)
Date
Msg-id 199906142153.RAA16276@candle.pha.pa.us
Whole thread Raw
Responses Cleaning up function interface (was Re: Patch for m68k architecture)
Re: [PORTS] Patch for m68k architecture (fwd)
List 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@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Docs done?
Next
From: Tom Lane
Date:
Subject: Cleaning up function interface (was Re: Patch for m68k architecture)