This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug java/22166] 0x80000000/-1 is wrong in java
- From: "rmathew at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 30 Aug 2005 09:13:26 -0000
- Subject: [Bug java/22166] 0x80000000/-1 is wrong in java
- References: <20050623160559.22166.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rmathew at gcc dot gnu dot org 2005-08-30 09:13 -------
Actually, this looks like a more generic problem, not limited to Java.
Witness:
----------------------------------- 8< -----------------------------------
~/src/tmp/PR22166 > cat x.c
#include <stdio.h>
int main( void)
{
int i = 0x80000000;
int j = -1;
printf( "%u: %d\n", sizeof(int), i/j);
return 0;
}
~/src/tmp/PR22166 > mygcc --version
xgcc (GCC) 4.1.0 20050830 (experimental)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~/src/tmp/PR22166 > mygcc x.c
~/src/tmp/PR22166 > ./a.out
Floating point exception
~/src/tmp/PR22166 > mygcc -O1 x.c
~/src/tmp/PR22166 > ./a.out
4: -2147483648
~/src/tmp/PR22166 >
----------------------------------- 8< -----------------------------------
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22166