www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 1746] New: Enums with member initializers generate undefined symbols

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

           Summary: Enums with member initializers generate undefined
                    symbols
           Product: DGCC aka GDC
           Version: 0.24
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: link-failure
          Severity: critical
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn users.sf.net
        ReportedBy: pseus7 gmail.com


Steps to reproduce:

----- bug.d -----
module bug;

enum GDCBUG
{
    BUG = -1,
    ISSUE = -2,
    PROBLEM = -3
}
-----------------

Compile with:
gdmd -S bug.d

Test with:
cat bug.s | grep __s

Output:
.long   ___s.898
.local  ___s.898
.comm   ___s.898,0,1

========================

WORKAROUND:

----- bug.d -----
module bug;

enum GDCBUG
{
    GDC_WORKAROUND, //If the first member has no default value (or that value
is 0), no undefined symbols are produced.
    BUG = -1,
    ISSUE = -2,
    PROBLEM = -3
}
-----------------

Compile with:
gdmd -S bug.d

Test with:
cat bug.s | grep __s

Output:
(empty)

========================

First experienced by the Tango guys:
http://dsource.org/projects/tango/ticket/450

Now causing lots of problems for the gtkD guys:
http://www.dsource.org/projects/gtkd/ticket/4

This still happens in gdc-0.25-4.1.2-17 from Debian Lenny.


-- 
Dec 22 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1746






Added to DStress as
http://dstress.kuehne.cn/run/e/enum_52_A.d
http://dstress.kuehne.cn/run/e/enum_52_B.d
http://dstress.kuehne.cn/run/e/enum_52_C.d


-- 
Feb 25 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1746


svanleent gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |svanleent gmail.com





Still happens on revision 199 (with debian etch, x86_64)


-- 
Mar 13 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1746


dvdfrdmn users.sf.net changed:

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





Fixed in release 0.25 / svn 213.

Not sure if the description or the DStress cases actually test the problem(?)
Need to have two modules:

-- a.d --
enum E { A = 1, B = 2 }

-- b.d --
import a;
void main() { new E[10]; }

--


-- 
Apr 19 2008