www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5355] New: Global variables are not aligned

reply d-bugmail puremagic.com writes:
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



"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: -------
Dec 17 2010
next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 03 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jan 20 2012