Bug 17613 - Integer Division produces a Floating exception.
Summary: Integer Division produces a Floating exception.
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-22 15:54 UTC by Patrick Pelissier
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: alpha-unknown-freebsd5.2.1
Target: alpha-unknown-freebsd5.2.1
Build: alpha-unknown-freebsd5.2.1
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Pelissier 2004-09-22 15:54:08 UTC
The following program:

#include <limits.h>
int f(long a, long b);
int main()
{
  return f(LONG_MIN, 1);
}
int f(long a, long b)
{
  return a / b;
}

produces a "Floating exception (core dumped)" on alpha-unknown-freebsd5.2.1
(spe149.testdrive.hp.com) with:
gcc version 3.4.2 and gcc version 3.3.3 [FreeBSD] 20031106.

The test program was compiled without any flags:
spe149.testdrive.hp.com> /tmp/make/bin/gcc test3.c
spe149.testdrive.hp.com> ./a.out
Floating exception (core dumped)
spe149.testdrive.hp.com> /tmp/make/bin/gcc -v
Reading specs from /tmp/make/lib/gcc/alpha-unknown-freebsd5.2.1/3.4.2/specs
Configured with: ./configure --prefix=/tmp/gcc : (reconfigured) ./configure
--prefix=/tmp/gcc : (reconfigured) ./configure --prefix=/tmp/make
--enable-languages=c
Thread model: posix
gcc version 3.4.2

The problem seems to be in the internal function "__divq" which produces the
exception.
Comment 1 Falk Hueffner 2004-09-22 23:22:55 UTC
__divq is provided by FreeBSD's libc. Please report a bug there.