[Issue 24226] New: operator `~=` appears to lead to useless bound checks

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 4 12:59:29 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24226

          Issue ID: 24226
           Summary: operator `~=` appears to lead to useless bound checks
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

For the following code:

```
extern(C) int printf(const char* f, ...);

int main()
{
    const(char)[] fmt;
    fmt ~= "\n\0";
    return 0;
}   
```

The output assembly show calls related to bound checks
https://godbolt.org/z/nKhsEWvoT,
apparently in the runtime functions.

But can bounds be violated here ?

--


More information about the Digitalmars-d-bugs mailing list