[Issue 4835] New: DMD should warn about integer overflow in computed constant
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 7 10:09:48 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4835
Summary: DMD should warn about integer overflow in computed
constant
Product: D
Version: D2
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: lars.holowko at gmail.com
--- Comment #0 from Lars Holowko <lars.holowko at gmail.com> 2010-09-07 10:09:23 PDT ---
I got bitten by this when I wanted to create a 6GB large file to test 64 bit
support in std.stdio with dmd 2.048.
The output of:
import std.stdio;
void main(string args[])
{
long l_dangerous = 1024 * 1024 * 1024 * 6;
writefln("l_dangerous = 0x%x", l_dangerous);
writefln("l_dangerous = %s", l_dangerous);
long l_ok = 1024 * 1024 * 1024 * 6L;
writefln("l_ok = 0x%x", l_ok);
writefln("l_ok = %s", l_ok);
return;
}
is
l_dangerous = 0xffffffff80000000
l_dangerous = -2147483648
l_ok = 0x180000000
l_ok = 6442450944
dmd 2.048 did not issue a warning about the integer overflow (neither with or
without -w)
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list