D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23173 - "Error: signed integer overflow" for compiler generated string of `long.min`
Summary: "Error: signed integer overflow" for compiler generated string of `long.min`
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2022-06-08 15:40 UTC by JR
Modified: 2022-08-11 09:54 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description JR 2022-06-08 15:40:41 UTC
Arch/Manjaro x86_64, dmd 2.100.0.

void main()
{
    mixin("long l = ", long.min, ";");
}

// Error: signed integer overflow

int works.
Comment 1 Dennis 2022-06-15 19:24:38 UTC
This is not related to mixin, it's how DMD converts the number to a string:

```D
pragma(msg, long(-9223372036854775808));
```

Prints `-9223372036854775808L`, with an L suffix. The problem is, the - operator is not part of the integer literal, so it's lexing `9223372036854775808L` which doesn't fit because L denotes a signed long.
Comment 2 Dlang Bot 2022-06-15 19:29:56 UTC
@dkorpel created dlang/dmd pull request #14218 "Fix Issue 23173 - "Error: signed integer overflow" for compiler gener…" fixing this issue:

- Fix Issue 23173 - "Error: signed integer overflow" for compiler generated string of `long.min`

https://github.com/dlang/dmd/pull/14218
Comment 3 Dennis 2022-08-11 09:54:07 UTC
The bot didn't close this for some reason.