>Description:
On mysql-3.23.33 on Tru64 4.0f, using gcc 2.95.2 (any optimisation
level), sql_select.cc will raise a FP exception at line 1785 of
sql/sql_select.cc, quoted here:
: if (tmp < best_time - records/(double) TIME_FOR_COMPARE)
At the time that the exception occurs, the values are:
tmp = 3
best_time = DBL_MAX
records = 1
This code works properly on virtually all other os's, so after
some amount of digging, it became apparent that it was a compiler
issue of some form. Eventually, I reduced the problem down to
this bit of code:
--
#include <stdio.h>
#include <float.h>
int main(void)
{
volatile double a = 1,
b = DBL_MAX;
a = b - 1;
return 0;
}
--
The volatile statement is just to ensure that the variables a and b
are stored in memory rather then being optimised away into
registers.
If you compile this with gcc, a FP exception will occur when you
attempt to subtract 1 from b (=DBL_MAX). This is caused by the fact
that Alpha's FP handling is pretty damn weird, to say the least.
This behaviour can be "fixed" by using the "-mieee" compiler option
in gcc.
>How-To-Repeat:
Stuff some non-trivial select statements into a mysql server
compiled in this way, and it will crash very quickly.
Alternatively, try compiling/running the demo code given above.
>Fix:
Add "-mieee" to CXXFLAGS and CFLAGS.
>Submitter-Id: <submitter ID>
>Originator: Nick Hilliard
>Organization:
>MySQL support: none
>Synopsis: FP problems on alpha / gcc
>Severity: serious
>Priority: high
>Category: mysql
>Class: sw-bug
>Release: mysql-3.23.33 (Source distribution)
>Environment:
System: OSF1 fafnir V4.0 1229 alpha
Machine: alpha
Some paths: /common/bin/perl /local/bin/make /common/bin/gmake /local/bin/gcc
/usr/bin/cc
GCC: Reading specs from /local/lib/gcc-lib/alphaev6-dec-osf4.0f/2.95.2/specs
gcc version 2.95.2 19991024 (release)
Compilation info: CC='gcc' CFLAGS='-mieee' CXX='c++' CXXFLAGS='-mieee'
LDFLAGS='-s'
LIBC:
lrwxr-xr-x 1 root system 17 Dec 20 14:54 /lib/libc.a -> ../ccs/lib/libc.a
lrwxr-xr-x 1 root system 17 Dec 20 14:54 /usr/lib/libc.a ->
../ccs/lib/libc.a
Configure command: ./configure --enable-assembler --with-mysqld-user=mysql
--without-debug --without-bench --with-charset=latin1 --prefix=/local/mysql
Perl: This is perl, version 5.005_03 built for alpha-dec_osf
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php