Thread overview
[Issue 9710] New: Pointer enums crash dmd
Mar 13, 2013
NCrashed@gmail.com
Mar 13, 2013
NCrashed@gmail.com
Mar 14, 2013
NCrashed@gmail.com
Jul 28, 2013
Henning Pohl
Jul 28, 2013
Walter Bright
March 13, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9710

           Summary: Pointer enums crash dmd
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: NCrashed@gmail.com


--- Comment #0 from NCrashed@gmail.com 2013-03-13 13:01:08 PDT ---
Reveals while porting old C library, below code crashes dmd v2.062 without any error reported:

long gi;
enum gi0 = ((cast(int *)&gi)[0]);
enum gi1 = ((cast(int *)&gi)[1]);

void main()
{

}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 13, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9710



--- Comment #1 from NCrashed@gmail.com 2013-03-13 13:05:45 PDT ---
Appears only at Windows.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 13, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9710


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #2 from bearophile_hugs@eml.cc 2013-03-13 13:08:00 PDT ---
If you port C code them maybe you want to write:


__gshared long gi;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 14, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9710



--- Comment #3 from NCrashed@gmail.com 2013-03-14 07:08:09 PDT ---
(In reply to comment #2)
> If you port C code them maybe you want to write:
> 
> 
> __gshared long gi;

It is doesn't matter, this code doesn't have sence in D, enums are calculated in compile time, but preprocessor just pastes code in C.

When porting C code, it is very difficult to find such error due dmd just crashes without any message.

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


Henning Pohl <henning@still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice, pull
                 CC|                            |henning@still-hidden.de


--- Comment #4 from Henning Pohl <henning@still-hidden.de> 2013-07-28 12:28:25 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2400

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



--- Comment #5 from github-bugzilla@puremagic.com 2013-07-28 16:52:19 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/0da20b2a26aac4ce086f90f3a0441479785fb741 fix issue 9710 - Pointer enums crash dmd

https://github.com/D-Programming-Language/dmd/commit/f4c79c69fe4196b83ceb3ef10d56670a52291c0e Merge pull request #2400 from hpohl/9710

fix issue 9710 - Pointer enums crash dmd

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


Walter Bright <bugzilla@digitalmars.com> changed:

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


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