May 09

I has a program use with a bug cause me long time to find.

I use struct inside other struct, children struct has a memory pointer like this:

struct Block {
   void* s;
}

And it can be put anywhere in parent struct, when use with fiber, some time it require member align with 16.

auto diff =  (cast(size_t) &(context.block)) % (size_t.sizeof *2);

If the diff is 8, I get error like this:

==32255==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x59808054d4d9 bp 0x716c2111ad10 sp 0x716c2111abf0 T0)
==32255==The signal is caused by a READ memory access.
==32255==Hint: this fault was caused by a dereference of a high value address (see register values below).  Disassemble the provided pc to learn which register was used.

I use 1.29.0-git-0b81277.

This is a new bug, and it work for my old ldc 1.28.1 on alpine.