Bug 24787 – Error signed integer overflow

Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-10-01T10:47:17Z
Last change time
2024-12-13T19:37:40Z
Assigned to
No Owner
Creator
cbleser
Moved to GitHub: dmd#20521 →

Attachments

IDFilenameSummaryContent-TypeSize
1918test.dTest programapplication/x-dsrc101

Comments

Comment #0 by cr — 2024-10-01T10:47:17Z
Created attachment 1918 Test program The value long.min written as decimal results in an overflow error, both for ldc2 and dmd. long z=-9223372036854775808L; Error: signed integer overflow Compiler used dmd --version DMD64 D Compiler v2.109.0-rc.1 Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved written by Walter Bright ldc2 --version LDC - the LLVM D compiler (1.39.0): based on DMD v2.109.1 and LLVM 18.1.6 built with LDC - the LLVM D compiler (1.39.0)
Comment #1 by dkorpel — 2024-10-01T12:15:34Z
That expression gets parsed as -(9223372036854775808L), and 9223372036854775808 does not fit in a long, but you require it to be a long with the L suffix. You can remove the L suffix, or replace it with UL, and then the program works. Since this is filed as an enhancement request, what part of this behavior do you want to see changed exactly?
Comment #2 by robert.schadek — 2024-12-13T19:37:40Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20521 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB