List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:March 30 1999 9:00am
Subject:SIGFPE coredump inserting maximum bigint value
View as plain text  
>>>>> "Anton" == Anton Krasovsky <anton@stripped> writes:

>> Description:
Anton> 	I'v getting coredump because of receiveing SIGFPE
Anton> 	when I try to insert maximum possible value
Anton> 	18446744073709551615 to unsigned bigint column
Anton> 	this not happens with hex value (0xffffffffffffffff)
>> How-To-Repeat:
Anton> #
Anton> # Table structure for table 'ad'
Anton> #
Anton> CREATE TABLE ad (
Anton>   id bigint(20) unsigned DEFAULT '0' NOT NULL auto_increment,
Anton>   client bigint(20) DEFAULT '0' NOT NULL,
Anton>   target bigint(20) unsigned DEFAULT '0' NOT NULL,
Anton>   category bigint(20) unsigned DEFAULT '0' NOT NULL,
Anton>   image varchar(255) DEFAULT 'UNKNOWN' NOT NULL,
Anton>   reference varchar(255) DEFAULT 'UNKNOWN' NOT NULL,
Anton>   impressions int(10) unsigned DEFAULT '0' NOT NULL,
Anton>   clicks bigint(20) unsigned DEFAULT '0' NOT NULL,
Anton>   status enum('on','off','pending') DEFAULT 'pending' NOT NULL,
Anton>   PRIMARY KEY (id)
Anton> );

Anton> #
Anton> # Dumping data for table 'ad'
Anton> #

Anton> INSERT INTO ad VALUES
> (1,1,18446744073709551615,1,'http://pekod.trans-m-radio.com/banners/bannerd10652.gif','http://www.one.com',30,0,'on');
Anton> INSERT INTO ad VALUES
> (2,2,18446744073709551615,1,'http://pekod.trans-m-radio.com/banners/bannero10648.gif','http://www.two.com',94,0,'on');

Anton> This program have the same effect: (tested under FreeBSD 3.0 and RedHat 5.1)

Anton> #include <stdio.h>
Anton> void main (void) {
Anton> unsigned long long ull=18446744073709551615ULL;
Anton> double d;
Anton> d = (double) ull;
Anton> printf("double   value %f\n", d);
Anton> printf("longlong value %qu\n", ull);
Anton> ull = (unsigned long long) d;
Anton> }

<cut>

Hi!

I tested this on RedHat 5.2 with gcc 2.9 without any problems.

I suspect this is a gcc bug;  Could you try to compile your test
program with egcs 1.1.3.

Regards,
Monty
Thread
SIGFPE coredump inserting maximum bigint valueAnton Krasovsky29 Mar
  • SIGFPE coredump inserting maximum bigint valueMichael Widenius30 Mar