Thread: Port Bug Report: Would not build with -O2 flags set

Port Bug Report: Would not build with -O2 flags set

From
Unprivileged user
Date:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               : Ritch Azocar
Your email address      : admin@dqu.cc.ca.us

Category                : install: compile
Severity                : serious

Summary: Would not build with -O2 flags set

System Configuration
--------------------
  Operating System   : Linux 2.2.3 ELF RedHat 5.1

  PostgreSQL version : 6.4.2

  Compiler used      : gcc 2.7.3

Hardware:
---------
DEC Multia 21066A, 64M RAM

Versions of other tools:
------------------------
egcs 1.0.3
make 3.7.6

--------------------------------------------------------------------------

Problem Description:
--------------------
Several targets in the backend/utils/adt directory could not be built with the optimize more (-O2) flags set.
datetime.cand dt.c I'm sure about, I don't know about any others because I removed -O2 from CFLAGS in Makefile.global
andwas able to build.  I don't relly care about optimum performance (I'm running on a 166MHz Alpha 21066A) so I didin't
spendthe time to compile individual targets with and without optimization.  I couldn't build the ODBC interface (-O2
flagnot set) at all.  I haven't tried to build it independently of the postgresql build yet.  TCL & Perl worked fine. 

--------------------------------------------------------------------------

Test Case:
----------


--------------------------------------------------------------------------

Solution:
---------
Turn off -O2 in CFLAGS

--------------------------------------------------------------------------


Re: [PORTS] Port Bug Report: Would not build with -O2 flags set

From
Bruce Momjian
Date:
This is not a suprise, and something we have been looking at in 6.5beta.
egcs does some optimization of function calls with short int parameters,
and calling the adt functions through function pointers triggers a
problem.

Only certain platforms do this optimization.  I don't think we can fix
it for 6.5, but it is good to know.



>
> ============================================================================
>                         POSTGRESQL BUG REPORT TEMPLATE
> ============================================================================
>
>
> Your name               : Ritch Azocar
> Your email address      : admin@dqu.cc.ca.us
>
> Category                : install: compile
> Severity                : serious
>
> Summary: Would not build with -O2 flags set
>
> System Configuration
> --------------------
>   Operating System   : Linux 2.2.3 ELF RedHat 5.1
>
>   PostgreSQL version : 6.4.2
>
>   Compiler used      : gcc 2.7.3
>
> Hardware:
> ---------
> DEC Multia 21066A, 64M RAM
>
> Versions of other tools:
> ------------------------
> egcs 1.0.3
> make 3.7.6
>
> --------------------------------------------------------------------------
>
> Problem Description:
> --------------------
> Several targets in the backend/utils/adt directory could not be built with the optimize more (-O2) flags set.
datetime.cand dt.c I'm sure about, I don't know about any others because I removed -O2 from CFLAGS in Makefile.global
andwas able to build.  I don't relly care about optimum performance (I'm running on a 166MHz Alpha 21066A) so I didin't
spendthe time to compile individual targets with and without optimization.  I couldn't build the ODBC interface (-O2
flagnot set) at all.  I haven't tried to build it independently of the postgresql build yet.  TCL & Perl worked fine. 
>
> --------------------------------------------------------------------------
>
> Test Case:
> ----------
>
>
> --------------------------------------------------------------------------
>
> Solution:
> ---------
> Turn off -O2 in CFLAGS
>
> --------------------------------------------------------------------------
>
>
>


--
  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, Pennsylvania 19026

Re: [PORTS] Port Bug Report: Would not build with -O2 flags set

From
Thomas Lockhart
Date:
> This is not a suprise, and something we have been looking at in 6.5beta.
> egcs does some optimization of function calls with short int parameters,
> and calling the adt functions through function pointers triggers a
> problem.
> Only certain platforms do this optimization.  I don't think we can fix
> it for 6.5, but it is good to know.

It is most likely a 64bit issue, since my RH-5.2/egcs-1.1.2 machine
does not show a problem (other than floating point funny business with
rounding).

                    - Thomas

> > Summary: Would not build with -O2 flags set
> >   Operating System   : Linux 2.2.3 ELF RedHat 5.1
> >   PostgreSQL version : 6.4.2
> >   Compiler used      : gcc 2.7.3
> > DEC Multia 21066A, 64M RAM
> > egcs 1.0.3
> > make 3.7.6

--
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California

Re: [PORTS] Port Bug Report: Would not build with -O2 flags set

From
Bruce Momjian
Date:
> > This is not a suprise, and something we have been looking at in 6.5beta.
> > egcs does some optimization of function calls with short int parameters,
> > and calling the adt functions through function pointers triggers a
> > problem.
> > Only certain platforms do this optimization.  I don't think we can fix
> > it for 6.5, but it is good to know.
>
> It is most likely a 64bit issue, since my RH-5.2/egcs-1.1.2 machine
> does not show a problem (other than floating point funny business with
> rounding).
>

But hs is on an alpha.  Could be very different optimizations on the
different platforms, no?

--
  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, Pennsylvania 19026

Re: [PORTS] Port Bug Report: Would not build with -O2 flags set

From
Thomas Lockhart
Date:
> > > Only certain platforms do this optimization.  I don't think we can fix
> > > it for 6.5, but it is good to know.
> > It is most likely a 64bit issue, since my RH-5.2/egcs-1.1.2 machine
> > does not show a problem (other than floating point funny business with
> > rounding).
> But hs is on an alpha.  Could be very different optimizations on the
> different platforms, no?

Sure. But gcc support for Alphas has been around for years, so imho
the most likely cause for the difference is a size issue in Postgres,
not an inability on the part of gcc to optimize code.

                         - Thomas

--
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California

Re: [PORTS] Port Bug Report: Would not build with -O2 flags set

From
Bruce Momjian
Date:
> > > > Only certain platforms do this optimization.  I don't think we can fix
> > > > it for 6.5, but it is good to know.
> > > It is most likely a 64bit issue, since my RH-5.2/egcs-1.1.2 machine
> > > does not show a problem (other than floating point funny business with
> > > rounding).
> > But hs is on an alpha.  Could be very different optimizations on the
> > different platforms, no?
>
> Sure. But gcc support for Alphas has been around for years, so imho
> the most likely cause for the difference is a size issue in Postgres,
> not an inability on the part of gcc to optimize code.

But he is running egcs alpha, not gcc alpha.

--
  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, Pennsylvania 19026

Re: [PORTS] Port Bug Report: Would not build with -O2 flags set

From
Thomas Lockhart
Date:
> > Sure. But gcc support for Alphas has been around for years, so
> > imho the most likely cause for the difference is a size issue in
> > Postgres, not an inability on the part of gcc to optimize code.
> But he is running egcs alpha, not gcc alpha.

*shrug* They started out as the same thing. I was guessing at the
nature of the problem; we'll see what it turns out to be...

                      - Thomas

--
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California