[Issue 21038] Wrong codegen when calling wcslen

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 7 02:39:44 UTC 2020


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> ---
For the program:

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

the output generated is:

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

It's a surprise to me that a 4 byte element array is supposed to be aligned to
8 bytes. I'm not seeing where this is a requirement?

--


More information about the Digitalmars-d-bugs mailing list