Issue 24752 - betterC memset link errors with template+array
Summary: betterC memset link errors with template+array
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-08 11:02 UTC by tg
Modified: 2024-09-09 10:26 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 tg 2024-09-08 11:02:43 UTC
Possibly related to other array `memset` errors already reported before. The following code fails to link with `dmd` but works fine with `ldc2` on:

- Void Linux 
- DMD64 D Compiler v2.101.1
- Args: `-betterC`

```
void fn(T, int N)(const T[N] arr) {
}

extern (C) void main() {

  fn([1, 2]);
  fn([1, 2, 3]);

  fn([1, 2, 2]);
  // same size array with different values fails 
}
```

source/bug.d:(.text.main[main]+0x60): undefined reference to `_memset32'
Comment 1 Nick Treleaven 2024-09-08 20:47:09 UTC
Works for me with DMD64 D Compiler v2.109.0 on Linux Mint.
Comment 2 tg 2024-09-09 10:23:50 UTC
I just tested again with DMD64 D Compiler v2.104.2 on Alpine Linux and
with DMD64 D Compiler v2.109.1 on Void Linux, they both work. I should have tested with a more recent version first. Sorry about that.
Comment 3 tg 2024-09-09 10:26:09 UTC
Resolved.