Bug 23934 – Literal integer multiplication overflow is allowed in CTFE

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-05-24T12:03:36Z
Last change time
2024-12-13T19:29:14Z
Keywords
pull
Assigned to
No Owner
Creator
Eyal
Moved to GitHub: dmd#20287 →

Comments

Comment #0 by eyal — 2023-05-24T12:03:36Z
This example program generates the following assertion failure: static assert(1000*1000*1000*1000 > 0); // Error: static assert: `-727379968 > 0` is false It would detect bugs earlier if constant-folding/CTFE execution of multiplication disallowed overflow.
Comment #1 by dlang-bot — 2023-05-25T01:18:00Z
@ljmf00 created dlang/dmd pull request #15266 "constfold: multiplication should check for overflow" fixing this issue: - constfold: multiplication should check for overflow Fixes issue 23934. Signed-off-by: Luís Ferreira <[email protected]> https://github.com/dlang/dmd/pull/15266
Comment #2 by robert.schadek — 2024-12-13T19:29:14Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20287 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB