[Issue 15975] TLS not scanned correctly for main thread

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 2 00:45:21 PDT 2016


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

--- Comment #2 from Rainer Schuetze <r.sagitario at gmx.de> ---
Sorry, screwed up the test completely. It is not the variable that is
misaligned, but the range scanned by the GC. Use this test program:

import core.stdc.stdio;
import rt.sections;

void* tls;

void main()
{
    foreach (ref sg; SectionGroup)
    {
        foreach (rng; sg.gcRanges)
            printf("glob: beg = %p  end = %p\n", rng.ptr, rng.ptr +
rng.length);
    }
    if (auto arr = initTLSRanges()) 
        foreach (rng; *arr)
            printf("tls:  beg = %p  end = %p\n", rng.ptr, rng.ptr +
rng.length);

    printf("&tls = %p\n", &tls);
}

It prints:
glob: beg = 0x6299f0  end = 0x62e3a8
tls:  beg = 0x7fd37dfdb717  end = 0x7fd37dfdba40
&tls = 0x7fd37dfdb710

--


More information about the Digitalmars-d-bugs mailing list