digitalmars.D.bugs - [Issue 17778] New: Creating a static array with duplicates in
- via Digitalmars-d-bugs (56/56) Aug 25 2017 https://issues.dlang.org/show_bug.cgi?id=17778
https://issues.dlang.org/show_bug.cgi?id=17778 Issue ID: 17778 Summary: Creating a static array with duplicates in betterC causes "undefined reference to _memset32" linker failure Product: D Version: D2 Hardware: x86 OS: Linux Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: azi.hassan live.fr The following has been tested on Lubuntu 14.04 32 bits with the latest dmd beta (dmd v2.076.0-b2-dirty). Attempting to create a static int array (with a known size at compile time) that has adjacent duplicates in it seems to require an absent _memset32 function. Here's a stripped down version of the code that causes it : import core.stdc.stdio; extern(C) int main() { int[3] array = [12, 12, 11]; return 0; } Here's a second version : import core.stdc.stdio; extern(C) int main() { int[3] array; array[] = 3; return 0; } And here's the error : $ dmd -betterC -g test.d test.o : Dans la fonction « main » : /home/hassan/scripts/dailyprogrammer/test.d:5 : référence indéfinie vers « _memset32 » collect2: error: ld returned 1 exit status Error: linker exited with status 1 Arrays of bool or char compile without problem. Arrays of double or long complain about the absence of _memset64. Note that it only fails when the duplicates are adjacent. The following code compiles : import core.stdc.stdio; extern(C) int main() { char[4] letters = ['a', 'a', 'a', 'a']; int[3] numbers = [12, 11, 12]; //non-adjacent duplicates bool[6] booleans = [true, true, true, true, true, true]; long[3] longs = [12, 11, 12]; int[3] numbers = [0, 0, 0]; //zeros are fine too return 0; } --
Aug 25 2017