www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11069] New: DMD (github HEAD) Linker Regression

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

           Summary: DMD (github HEAD) Linker Regression
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: puneet coverify.org


--- Comment #0 from Puneet Goel <puneet coverify.org> 2013-09-19 04:12:51 PDT
---
The following reduced code example fails to link. It seems to be due to DMD
checkin 12bb9afb753ad2f2aef65550b960357c63854cbc -- fix Issue 10441 - Static
libraries too big. Compiles fine if I try with one version before that.

On my Linux x64 box I get:

$ rdmd test.d
/tmp/.rdmd-1000/rdmd-test.d-C130B18713BE4647AF6BF8F764A06FDD/objs/test.o: In
function
`_D3std9container32__T10BinaryHeapTAS4test3Bar3FooZ10BinaryHeap3popMFAS4test3Bar3FooZv':
__entrypoint.d:(.text._D3std9container32__T10BinaryHeapTAS4test3Bar3FooZ10BinaryHeap3popMFAS4test3Bar3FooZv+0x5c):
undefined reference to
`_D3std5array25__T5emptyTS4test3Bar3FooZ5emptyFNaNbNdNfxAS4test3Bar3FooZb'


// test.d Reduced code example:

class Bar {
  import std.container: BinaryHeap;
  BinaryHeap!(Foo[]) Heap;
  struct Foo {
    int opCmp(Foo ) {
      return 1;
    }
  }
}

void main() {}

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


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |link-failure, pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-09-20 10:16:16 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2577

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


Temtaime <temtaime gmail.com> changed:

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


--- Comment #2 from Temtaime <temtaime gmail.com> 2013-09-22 04:11:31 PDT ---
Kenji, it's not a full solution. 
I've make test case from my project.
It's too strange test case, but as it is.

A.d:
import C;
import D;

void foo() {
    Vector2 rsm;
    readWriteVariable(rsm);
}

void main() {
}

B.d:
import D;

import std.algorithm;


void bar() {
    Vector2[] tc;
    sort(tc);
}

C.d:
import std.traits;

void readWriteVariable(T)(ref T data) {

    foreach(it; __traits(allMembers, T))
            enum vValid = mixin(`is(FunctionTypeOf!(T.` ~ it ~ `) ==
function)`);

}

D.d:
struct Matrix(T, uint _M) {
    int opCmp()(auto ref in Matrix b) const {
        return 0;
    }

    pure auto opDispatch(string s)() {
        enum L = s.length;
        Matrix!(T, L) ret;
        return ret;
    }

    pure Matrix normalized() {
        return Matrix();
    }
}

alias Matrix!(float, 2) Vector2;


Problem exists only if files compiled into single objs and then linked
together.

dmd A -c
dmd b -c
dmd c -c
dmd d -c
dmd a.obj b.obj c.obj d.obj

 Error 42: Symbol Undefined
_D1D16__T6MatrixTfVi2Z6Matrix8__xopCmpFKxS1D16__T6Ma
trixTfVi2Z6MatrixKxS1D16__T6MatrixTfVi2Z6MatrixZi
b.obj(b)
 Error 42: Symbol Undefined
_D1D16__T6MatrixTfVk8Z6Matrix8__xopCmpFKxS1D16__T6Ma
trixTfVk8Z6MatrixKxS1D16__T6MatrixTfVk8Z6MatrixZi
b.obj(b)
 Error 42: Symbol Undefined
_D1D16__T6MatrixTfVk6Z6Matrix8__xopCmpFKxS1D16__T6Ma
trixTfVk6Z6MatrixKxS1D16__T6MatrixTfVk6Z6MatrixZi
b.obj(b)
 Error 42: Symbol Undefined
_D1D16__T6MatrixTfVk9Z6Matrix8__xopCmpFKxS1D16__T6Ma
trixTfVk9Z6MatrixKxS1D16__T6MatrixTfVk9Z6MatrixZi


If something is removed from test case, then linking is ok.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11069



--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2013-09-22 08:03:50 PDT ---
(In reply to comment #2)
  Error 42: Symbol Undefined
 _D1D16__T6MatrixTfVi2Z6Matrix8__xopCmpFKxS1D16__T6Ma
 trixTfVi2Z6MatrixKxS1D16__T6MatrixTfVi2Z6MatrixZi
 b.obj(b)
  Error 42: Symbol Undefined
 _D1D16__T6MatrixTfVk8Z6Matrix8__xopCmpFKxS1D16__T6Ma
 trixTfVk8Z6MatrixKxS1D16__T6MatrixTfVk8Z6MatrixZi
 b.obj(b)
  Error 42: Symbol Undefined
 _D1D16__T6MatrixTfVk6Z6Matrix8__xopCmpFKxS1D16__T6Ma
 trixTfVk6Z6MatrixKxS1D16__T6MatrixTfVk6Z6MatrixZi
 b.obj(b)
  Error 42: Symbol Undefined
 _D1D16__T6MatrixTfVk9Z6Matrix8__xopCmpFKxS1D16__T6Ma
 trixTfVk9Z6MatrixKxS1D16__T6MatrixTfVk9Z6MatrixZi
OK, I confirmed the issue. And updated the PR to fix it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11069



--- Comment #4 from github-bugzilla puremagic.com 2013-09-23 11:55:54 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c2ae0b2807c1863ef6653668478ae778fe4ff88e
fix Issue 11069 - DMD (github HEAD) Linker Regression

https://github.com/D-Programming-Language/dmd/commit/3e8460657b82b4ff38ece6fabc7e4a3015717529
Merge pull request #2577 from 9rnsr/fix11069

[REG2.064a] Issue 11069 - DMD (github HEAD) Linker Regression

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 23 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11069


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: -------
Sep 23 2013