Thanks to visit codestin.com
Credit goes to postgrespro.com

Re: GIN FailedAssertions on Itanium2 with Intel compiler - Mailing list 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: [email protected]
  WWW: http://www.sigaev.ru/
 


pgsql-hackers by date:

Previous
From: "Victor B. Wagner"
Date:
Subject: Re: [PATCHES] Backend SSL configuration enhancement
Next
From: Peter Eisentraut
Date:
Subject: Prepared statements considered harmful