divide overflow

Jason Schonberg schon@mips.com
Thu May 20 11:53:00 GMT 1999


The following code runs on a Sparc Solaris 2.6 system but fails with a "Floating 
exception (core dumped)" on an X86 Redhat 6.0 system.

Both systems were using egcs-1.1.2

_____
#include <limits.h>

int main()
{
 long int A, B, C;
 A = INT_MIN;
 B = -1;
 C = A/B;
}
_____

[schon@pc-linux fptest]$ egcs -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
[schon@pc-linux fptest]$ egcs -o run fptest.c 
[schon@pc-linux fptest]$ ./run
Floating exception (core dumped)
[schon@pc-linux fptest]$ uname -a
Linux pc-linux 2.2.5-15 #1 Mon Apr 19 23:00:46 EDT 1999 i686 unknown
[schon@pc-linux fptest]$ 
_____
> egcs -v
Reading specs from 
/usr/local/native/egcs-1.1.2/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
> egcs -o run fptest.c
> ./run
> uname -a
SunOS lightyear 5.6 Generic_105181-06 sun4u sparc
_____

I think the above has all the information needed to reproduce the problem.  I 
would be pleased to provide more information if you would find it useful.

Is this considered to be a bug in the compiler or a portability issue in user 
code?

Thanks.

Jason Schonberg
schon@mips.com



More information about the Gcc-bugs mailing list