-
Type:
Bug
-
Resolution: Not an Issue
-
Priority:
P4
-
None
-
Affects Version/s: 21.0.10
-
Component/s: core-libs
-
generic
ADDITIONAL SYSTEM INFORMATION :
It's from the JDK20 used in Netbeans. Obviously there is an arithmetic overflow, but the compiler does not notice it.
A DESCRIPTION OF THE PROBLEM :
The lines
final long all=256*256*256*256;
System.out.println(" all="+all);
results in
all=0
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
see description; use a 64bit machine
---------- BEGIN SOURCE ----------
see description
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
using long constants 256L*256*256*256 removes the bug
FREQUENCY :
ALWAYS
It's from the JDK20 used in Netbeans. Obviously there is an arithmetic overflow, but the compiler does not notice it.
A DESCRIPTION OF THE PROBLEM :
The lines
final long all=256*256*256*256;
System.out.println(" all="+all);
results in
all=0
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
see description; use a 64bit machine
---------- BEGIN SOURCE ----------
see description
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
using long constants 256L*256*256*256 removes the bug
FREQUENCY :
ALWAYS