www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5482] New: Crash with align(0)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5482

           Summary: Crash with align(0)
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This crashes DMD 2.051:

align(0) struct Foo {
    char c;
    int i;
}
void main() {
    Foo f = Foo();
}


---------------

This causes an Access Violation with DMD 2.051:

align(0) struct Foo {
    int i, j;
}
void main() {
    Foo f = Foo();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 25 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5482




Cannot reproduce.
The second case gives a runtime access violation, but neither example causes a
compiler segfault.

Is align(0) really valid? I don't think it makes sense. It's definitely illegal
on Microsoft VC++, I don't see it documented on DMC++ or GCC, but in both cases
it appears unlikely.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 10 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5482





 Cannot reproduce.
You are right, to crash is the compiled program (with DMD 2.051 on Windows).
 The second case gives a runtime access violation, but neither example causes a
 compiler segfault.
As in the first case this time the compiled program gives: object.Error: Access Violation
 Is align(0) really valid? I don't think it makes sense.
I agree, I suggest to turn it into a compile-time error (as negative numbers already do). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 10 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5482


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



https://github.com/D-Programming-Language/dmd/commit/830011e21b22686932a65d1452965ae7589aadfc

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