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

Skip to content

Commit 889ec4b

Browse files
committed
Fix Intel compiler bug. Per discussion
'GIN FailedAssertions on Itanium2 with Intel compiler' in pgsql-hackers, http://archives.postgresql.org/pgsql-hackers/2006-08/msg01914.php
1 parent 642194b commit 889ec4b

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/backend/access/gin/ginutil.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.5 2006/07/14 14:52:16 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.6 2006/09/05 18:25:10 teodor Exp $
1212
*-------------------------------------------------------------------------
1313
*/
1414

@@ -122,7 +122,22 @@ compareEntries(GinState *ginstate, Datum a, Datum b) {
122122
}
123123

124124
static FmgrInfo* cmpDatumPtr=NULL;
125-
static bool needUnique = FALSE;
125+
126+
#if defined(__INTEL_COMPILER) && (defined(__ia64__) || defined(__ia64))
127+
/*
128+
* Intel Compiler on Intel Itanium with -O2 has a bug around
129+
* change static variable by user function called from
130+
* libc func: it doesn't change. So mark it as volatile.
131+
*
132+
* It's a pity, but it's impossible to define optimization
133+
* level here.
134+
*/
135+
#define VOLATILE volatile
136+
#else
137+
#define VOLATILE
138+
#endif
139+
140+
static bool VOLATILE needUnique = FALSE;
126141

127142
static int
128143
cmpEntries(const void * a, const void * b) {

0 commit comments

Comments
 (0)