>>>>> "Paul" == Paul DuBois <paul@stripped> writes:
Paul> At 9:57 PM +0200 2000-01-03, Michael Widenius wrote:
>> >>>>> "Jeremy" == Jeremy Cole <jcole@stripped> writes:
>>
Jeremy> Monty,
Jeremy> I didn't see anything about fixing the coredump problem on
>> FreeBSD with
>>
Jeremy> select floor(pow(2,63));
>>
Jeremy> Are you aware of this problem, or did it get fixed and not
>> added to the
Jeremy> ChangeLog?
>>
Jeremy> Later,
>>
Jeremy> Jeremy
>>
>> The above problem is only fixed in 3.23 and not in 3.22; I first want
>> to check that the fix is really ok on 3.23 before moving it back to 3.22
Paul> Just tried 3.23.8 on FreeBSD 3.3. The above SELECT statement still
Paul> crashes the server with a floating point exception.
Hi!
The problem was that configure didn't detect some of the defines to
fix this. I also started to think about problems when changing the
floating point interrupt handling when having threads and decided that
it's probably better to disable these for all threads.
Here is a final tested patch that should work :)
*** /my/monty/master/mysql-3.23.8-alpha/sql/item_func.cc Sun Dec 26 02:34:33 1999
--- ./item_func.cc Sat Jan 8 23:10:25 2000
***************
*** 23,59 ****
#include <hash.h>
#include <time.h>
- /* Fix hard crash on FreeBSD with floor */
-
- #if defined(HAVE_FPSETMASK) && defined(HAVE_IEEEFP_H)
- #include <ieeefp.h>
- #ifdef HAVE_FP_EXCEPT // Fix type conflict
- typedef fp_except fp_except_t;
- #endif
- #ifndef FP_X_DNML
- #define FP_X_DNML 0
- #endif
- #ifndef HAVE_FPRESETSTICKY
- #define fpresetsticky(A) fpsetsticky(~(A))
- #endif
-
- inline double my_floor(double A)
- {
- fp_except_t old=fpsetmask(0);
- fpresetsticky(~0);
- double tmp=floor(A);
- if (fpresetsticky(~0) & (FP_X_INV | FP_X_UFL | FP_X_DZ | FP_X_DNML))
- tmp=POSTFIX_ERROR;
- fpsetmask(old);
- return tmp;
- }
- #define floor(A) my_floor(A)
- #endif
-
-
-
/* return TRUE if item is a constant */
-
bool
eval_const_cond(COND *cond)
--- 23,29 ----
*** /my/monty/master/mysql-3.23.8-alpha/sql/mysqld.cc Tue Dec 28 05:41:29 1999
--- ./mysqld.cc Sat Jan 8 23:11:30 2000
***************
*** 61,66 ****
--- 61,86 ----
int deny_severity = LOG_WARNING;
#endif /* HAVE_LIBWRAP */
+ #if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
+ #include <ieeefp.h>
+ #ifdef HAVE_FP_EXCEPT // Fix type conflict
+ typedef fp_except fp_except_t;
+ #endif
+
+ /* We can't handle floating point expections with threads, so disable
+ this on freebsd
+ */
+
+ inline void reset_floating_point_exceptions()
+ {
+ /* Don't fall for overflow, underflow,divide-by-zero or loss of precision */
+ fp_except_t old=fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL |
+ FP_X_DZ | FP_X_IMP));
+ }
+ #else
+ #define reset_floating_point_exceptions()
+ #endif /* __FreeBSD__ && HAVE_IEEEFP_H */
+
#ifdef __cplusplus
}
#endif
***************
*** 1237,1242 ****
--- 1257,1263 ----
hostname_cache_init();
sql_cache_init();
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
+ reset_floating_point_exceptions();
/* Setup log files */
if (opt_log)
***************
*** 1927,1934 ****
#ifndef DBUG_OFF
{"debug", optional_argument, 0, '#'},
#endif
! {"default-table-type", required_argument,0,OPT_TABLE_TYPE},
! {"delay-key-write", no_argument, 0, (int) OPT_DELAY_KEY_WRITE},
{"enable-locking", no_argument, 0, (int) OPT_ENABLE_LOCK},
{"exit-info", optional_argument, 0, 'T'},
#ifdef __WIN32__
--- 1948,1956 ----
#ifndef DBUG_OFF
{"debug", optional_argument, 0, '#'},
#endif
! {"default-table-type",required_argument,0,OPT_TABLE_TYPE},
! {"delay-key-write-for-all-tables",
! no_argument, 0, (int) OPT_DELAY_KEY_WRITE},
{"enable-locking", no_argument, 0, (int) OPT_ENABLE_LOCK},
{"exit-info", optional_argument, 0, 'T'},
#ifdef __WIN32__
***************
*** 2150,2156 ****
puts("\
--default-table-type=type\n\
Set the default table type for tables\n\
! --delay-key-write Don't flush key buffer between writes\n\
--enable-locking Enable system locking\n\
-T, --exit-info Print some debug info at exit\n\
-?, --help Display this help and exit\n\
--- 2172,2180 ----
puts("\
--default-table-type=type\n\
Set the default table type for tables\n\
! --delay-key-write-for-all-tables
! Don't flush key buffers between writes for any MyISAM\n\
! table\n\
--enable-locking Enable system locking\n\
-T, --exit-info Print some debug info at exit\n\
-?, --help Display this help and exit\n\
***************
*** 2474,2479 ****
--- 2498,2504 ----
}
case OPT_DELAY_KEY_WRITE:
ha_open_options|=HA_OPEN_DELAY_KEY_WRITE;
+ myisam_delay_key_write=1;
break;
default:
fprintf(stderr,"%s: Unrecognized option: %c\n",my_progname,c);
Regards,
Monty