From: Date: June 21 2007 11:05am Subject: Re: bk commit into 5.0 tree (gkodinov:1.2494) BUG#27383 List-Archive: http://lists.mysql.com/commits/29251 Message-Id: MIME-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit Kostja, On 21.06.2007, at 01:30, Konstantin Osipov wrote: > * kgeorge@stripped [07/06/20 13:43]: >> ChangeSet@stripped, 2007-06-20 12:42:21+03:00, gkodinov@stripped >> +1 -0 >> Bug #27383: Crash in test "mysql_client_test" >> >> Fixed by making the intermediary variables volatile ( >> to not re-introduce the excess precision bug) and using >> the intermediary value instead of the char * buffer. >> Note that there can be loss of precision for both signed >> and unsigned 64 bit integers converted to double and back, >> so the check must stay there (even for compatibility >> reasons). >> Based on the excellent analysis in bug 28400. > > Please take a look at some other places where I believe I've been > dealing with > this problem before (in December 2004): > > case MYSQL_TYPE_FLOAT: > { > double data= my_strntod(&my_charset_latin1, value, length, > &endptr, &err); > float fdata= (float) data; > *param->error= (fdata != data) | test(err); > floatstore(buffer, fdata); > break; > } > > Here we have two variables on stack and do an assignment of > one to another. > Where does the solution with using volatile come from? Is it a > recommended workaround? > If the old solution works, please use it instead. According to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 you may still get excess precision from the fact that Intel FPU registers are used. You tried fixing that in some places in the code by using the value stored in the buffer instead of the variable for checking (look at the comments that you've added in fetch_long_with_conversion()) . However that is also not 100% error proof when optimized (according to http://gcc.gnu.org/bugs.html#nonbugs_c). So I took a middle approach (described in http://gcc.gnu.org/bugzilla/ show_bug.cgi?id=323#c87) : reverted to using variables for checking but added volatile to make sure it doesn't suffer the excess precision problem. Best Regards, Joro -- Georgi Kodinov, Senior Software Engineer MySQL AB, Plovdiv, Bulgaria, www.mysql.com Office: +359 32 634 397 Mobile: +359 887 700 566 Skype: georgekodinov Are you MySQL certified? www.mysql.com/certification