BUG #2740: gcc bug on intel mac with postgresql -O3 optimized build - Mailing list pgsql-bugs

From Alon Goldshuv
Subject BUG #2740: gcc bug on intel mac with postgresql -O3 optimized build
Date
Msg-id 200611061758.kA6HwntD056160@wwwmaster.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged online:

Bug reference:      2740
Logged by:          Alon Goldshuv
Email address:      agoldshuv@greenplum.com
PostgreSQL version: 8.1.5
Operating system:   Mac OSX intel
Description:        gcc bug on intel mac with postgresql -O3 optimized build
Details:

I don't know if this is a known issue already and was reported previously.
This is a gcc bug, and *not a postgresql bug*, but it affects query results
and should be of interest to intel mac pg users.

Regression tests showed wrong output for a query in the 'select_views' test
*only on intel mac*. Query is: SELECT * FROM street ORDER BY 1. We narrowed
it down to the '?#' operator which returns wrong results (in the 'street'
view it is actually a user defined 'path ## path' operator that is based on
the 'path ?# path' logic).

A simple way to reproduce without creating tables and running multi row
result queries is the following 1 line statement:

select path '((-122.1,37.3),(-122.2,37.5),(-122,37.5))' ?# path
'((-122.1697,37.375),(-122.1681,37.383))';

This statement should always return 'false'. However on the tested intel mac
platform it returned 'true'.

We ended up tracing it all the way to gcc. Turns out that the gcc version we
were using had a bug in one of the optimization flags that get included with
-O3, i believe it was function inlining. When compiling with -O2 or lower
the query would return the correct result.

We upgraded the xcode tools version with the latest - Xcode 2.4.1 released
31Oct2006, and that fixed the bug.

compiler with -O3 bug:
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5250)

updated bug free gcc:
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367)

regards,
Alon.

pgsql-bugs by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: BUG #2735: DEBUG: Error 2769: Custom Action GetAvailableLocales did not close 1 MSIHANDLEs
Next
From: Tom Lane
Date:
Subject: Re: BUG #2694: Memory allocation error when selecting array