Re: GIN FailedAssertions on Itanium2 with Intel compiler

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Cc: "Sergey E(dot) Koposov" <math(at)sai(dot)msu(dot)ru>
Subject: Re: GIN FailedAssertions on Itanium2 with Intel compiler
Date: 2006-08-31 09:48:09
Message-ID: 44F6B059.2040701@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Huh, it's a over-optimization by icc on Itanium. With -00 or -02 there is no any
problem, only -O2 produces such effect. The problem is in code at lines 125-172
in ginutils.c:

static bool needUnique = false;

int cmpFunc(...) {
...
if (...) needUnique = true;
...
}
...
needUnique = false;
qsort(...., cmpFunc);
if (needUnique) ....

And, needUnique was setted to true in last call of cmpFunc (by accident, in
fact), so between last call and checking of needUnique there isn't any call of
function. Insertion after qsort() any call (elog, for example) solves the problem.

If needUnique is marked as "volatile", all is ok too. But this way doesn't seem
to me as reasonable, because there is a lot of places with potentially the same
problem... and thats may cause unpredictable failures. May be, better way is
limiting optimization level on Itanium with icc.

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2006-08-31 11:56:29 Prepared statements considered harmful
Previous Message Stefan Kaltenbrunner 2006-08-31 09:29:38 Re: [PATCHES] Backend SSL configuration enhancement