BUG #2740: gcc bug on intel mac with postgresql -O3 optimized build

From: "Alon Goldshuv" <agoldshuv(at)greenplum(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2740: gcc bug on intel mac with postgresql -O3 optimized build
Date: 2006-11-06 17:58:49
Message-ID: 200611061758.kA6HwntD056160@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2740
Logged by: Alon Goldshuv
Email address: agoldshuv(at)greenplum(dot)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.

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-11-06 18:28:37 Re: BUG #2694: Memory allocation error when selecting array
Previous Message Mason Hale 2006-11-06 17:33:20 BUG #2739: INTERSECT ALL not working