Thread overview
[Issue 5355] New: Global variables are not aligned
Dec 18, 2010
Nick Voronin
[Issue 5355] TLS variables are not 16 byte aligned
Jul 03, 2011
yebblies
Jan 20, 2012
Walter Bright
December 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5355

           Summary: Global variables are not aligned
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: elfy.nv@gmail.com


--- Comment #0 from Nick Voronin <elfy.nv@gmail.com> 2010-12-17 18:36:37 PST ---
"Version D 2.007: Data items in static data segment >= 16 bytes in size are now paragraph aligned."

Yet this test shows that neither double[4] nor creal are aligned.

import core.stdc.stdio: printf;

int a;
double[4] d;
creal cr;

void main() {
    printf("%X:%u %X:%u %X:%u\n", &a, (cast(size_t)&a) % 8, &d,
(cast(size_t)&d) % 8, &cr, (cast(size_t)&cr) % 8);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 03, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5355


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |yebblies@gmail.com
           Platform|x86                         |All
            Summary|Global variables are not    |TLS variables are not 16
                   |aligned                     |byte aligned
         OS/Version|Windows                     |All
           Severity|regression                  |normal


--- Comment #1 from yebblies <yebblies@gmail.com> 2011-07-04 02:51:34 EST ---
Actually, those variables are in tls.  Variables in the static data segment do seem to be 16 byte aligned.

They appear to be all offset from 16 byte alignment by 4 bytes.

Leaving open as this is probably not intended.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5355


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |INVALID


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2012-01-20 13:53:24 PST ---
TLS segments are now all 16 byte aligned. However, individual variables are aligned based on their type. For example, arrays are aligned based on the alignment requirement of their element type. Arrays of double are aligned on 8 byte boundaries, not 16 bytes.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------