Re: Fuzzy substring searching with the pg_trgm extension - Mailing list pgsql-hackers

From Teodor Sigaev
Subject Re: Fuzzy substring searching with the pg_trgm extension
Date
Msg-id 5694C914.8030103@sigaev.ru
Whole thread Raw
In response to Re: Fuzzy substring searching with the pg_trgm extension  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
>> !                 float4        tmpsml = cnt_sml(qtrg, key, *recheck);
>>
>>                    /* strange bug at freebsd 5.2.1 and gcc 3.3.3 */
>> !                 res = (*(int *) &tmpsml == *(int *) &nlimit || tmpsml > nlimit) ? true : false;
>
> What's the compiler bug about?  This code and comment were introduced in
> cbfa4092bb (May 2004) without any explanation.  Do we still need to keep
> it, if &nlimit is now a local variable instead of a global?  FWIW the
> oldest GCC in the buildfarm is 3.4.2/3.4.3 (except for Gaur which uses

As I remeber, the problem was with x87 math coprocessor. Compiler (suppose, 
modern compiler could do it too) keeps tmpsml in internal 80-bit wide register 
and compares with 32-bit wide float. Of course, it depends on level of 
optimization and so, result of comparison was differ in optimization enabled and 
disabled instances. Such strange way I choose to force compiler to use main 
memory for tmpsml variable. Actually, I don't know better way even now.

-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
  WWW: http://www.sigaev.ru/
 



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Relation extension scalability
Next
From: Julien Rouhaud
Date:
Subject: Re: Removing Functionally Dependent GROUP BY Columns