www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5332] New: Undefined reference to zero length array

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

           Summary: Undefined reference to zero length array
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ibuclaw ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw ubuntu.com> 2010-12-08 13:10:18 PST ---
Testcase:

int[0] arr;
void main()
{
    auto a = arr;
}

Yields:
test.o: In function `_Dmain':
test.d:(.text._Dmain+0x16): undefined reference to `_D4test3arrG0i'
collect2: ld returned 1 exit status
--- errorlevel 1

Most likely cause I guess is incorrect mangling.

Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 08 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5332


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com


--- Comment #1 from Iain Buclaw <ibuclaw ubuntu.com> 2010-12-09 05:45:27 PST ---
Actually, it's something else. DMD doesn't output var declarations that have no
size.

Patch to always write out globals:

--- dmd~/toobj.c    2010-11-19 22:39:05.011906002 +0000
+++ dmd/toobj.c 2010-12-09 13:29:19.672718003 +0000
   -1287,7 +1287,7   
         else
             s->Sseg = DATA;
 #endif
-        if (sz)
+        if (1 || sz)
         {   outdata(s);
             if (isExport())
                 obj_export(s,0);


Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 09 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5332


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |link-failure, pull
                 CC|                            |yebblies gmail.com


--- Comment #2 from yebblies <yebblies gmail.com> 2012-02-03 19:04:41 EST ---
https://github.com/D-Programming-Language/dmd/pull/689

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



--- Comment #3 from github-bugzilla puremagic.com 2012-05-19 21:46:10 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/6a18e736d2296a7f041ba6d23ba73777a14ba5a7
Issue 5332 - Undefined reference to zero length array

Always emit globals, even if they are zero-length static arrays.

https://github.com/D-Programming-Language/dmd/commit/ab17ac3a249eb4485632c74e88dfe3c96d0b511c
Merge pull request #689 from yebblies/issue5332

Issue 5332 - Undefined reference to zero length array

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5332



--- Comment #5 from github-bugzilla puremagic.com 2012-05-20 00:53:09 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c4ae9e312d7946e7041e065b26996abff92d4424
partial fix Issue 5332 - Undefined reference to zero length array

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5332



--- Comment #6 from github-bugzilla puremagic.com 2012-05-20 00:53:28 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d6ee976c5c956a03ba807d1ce411685903c2664b
partial fix Issue 5332 - Undefined reference to zero length array

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5332


bearophile_hugs eml.cc changed:

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


--- Comment #7 from bearophile_hugs eml.cc 2012-05-20 05:29:04 PDT ---
Maybe related to Issue 7997

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