!                               float4          tmpsml = cnt_sml(qtrg, key, 

                                /* 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: teo...@sigaev.ru
                                                   WWW: http://www.sigaev.ru/

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to