[Issue 21038] Wrong codegen when calling wcslen

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 7 02:43:55 UTC 2020


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

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
Oh, I see now. For:

alias wchar_t = dchar;
const(wchar)* x = "xz";
const(wchar_t)* name = "abcd";
void test()
{
    assert((cast(size_t) name) % wchar_t.sizeof == 0); /* Fails. Should pass.
*/
}

the result is:

Section 6  .rodata  PROGBITS,ALLOC,SIZE=0x0030(48),OFFSET=0x0040,ALIGN=16
 0040:  78  0 7a  0  0  0 61  0  0  0 62  0  0  0 63  0   x.z...a...b...c.
 0050:   0  0 64  0  0  0  0  0  0  0  0  0  0  0  0  0   ..d.............
 0060:   4 10  0  0  0  0  0  0 74 65 73 74  0  0  0  0   ........test....

which is wrongly aligned on a 2 byte boundary.

--


More information about the Digitalmars-d-bugs mailing list