Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita58ab6a

Browse files
committed
Merge branch 'PGPRO_pg_trgm' into PGPRO9_5
Fix strange bug with early gcc on 32-bit arch
2 parentsbff1188 +392073c commita58ab6a

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

‎contrib/pg_trgm/trgm_gist.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,12 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
296296

297297
if (GIST_LEAF(entry))
298298
{/* all leafs contains orig trgm */
299-
float4tmpsml=cnt_sml(qtrg,key,*recheck);
299+
/*
300+
* Prevent gcc optimizing the tmpsml variable using volatile
301+
* keyword. Otherwise comparison of nlimit and tmpsml may give
302+
* wrong results.
303+
*/
304+
float4volatiletmpsml=cnt_sml(qtrg,key,*recheck);
300305

301306
/* strange bug at freebsd 5.2.1 and gcc 3.3.3 */
302307
res= (*(int*)&tmpsml==*(int*)&nlimit||tmpsml>nlimit);
@@ -471,7 +476,13 @@ gtrgm_distance(PG_FUNCTION_ARGS)
471476
*recheck=strategy==SubwordDistanceStrategyNumber;
472477
if (GIST_LEAF(entry))
473478
{/* all leafs contains orig trgm */
474-
res=1.0-cnt_sml(qtrg,key,*recheck);
479+
/*
480+
* Prevent gcc optimizing the sml variable using volatile
481+
* keyword. Otherwise res can differ from the
482+
* subword_similarity_dist_op() function.
483+
*/
484+
float4volatilesml=cnt_sml(qtrg,key,*recheck);
485+
res=1.0-sml;
475486
}
476487
elseif (ISALLTRUE(key))
477488
{/* all leafs contains orig trgm */

‎contrib/pg_trgm/trgm_op.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,4 +1157,4 @@ subword_similarity_dist_commutator_op(PG_FUNCTION_ARGS)
11571157
PG_FREE_IF_COPY(in1,0);
11581158
PG_FREE_IF_COPY(in2,1);
11591159
PG_RETURN_FLOAT4(1.0-res);
1160-
}
1160+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp