wilzbach / tools-test

1 stars 0 forks source link

RDMD: -g switch produces linker error #137

Open wilzbach opened 8 years ago

wilzbach commented 8 years ago

Note: the issue was created automatically migrated from https://issues.dlang.org

Original bug ID: BZ#15533 From: Alexey G <golovanov_alexey@mail.ru> Reported version: D2 CC: gassa@mail.ru

wilzbach commented 8 years ago

Comment author: Alexey G <golovanov_alexey@mail.ru>

Created attachment 1572 reduced test case (see moduleB import)

From forum: http://forum.dlang.org/thread/causshkknlxqlbqrbnkv@ forum.dlang.org

OS: Windows 7 (32 bit) DMD: 2.069.2 and 2.070.0-b1 RDMD: build 20160103

Problem: import inside function produced linker error then -g switch used. Test files in attach:

moduleA.d test\moduleB.d test\moduleC.d

///////////// module moduleA;

public void funcA () { import test.moduleB: funcB; return; }

void main(string[] args) { return; }

///////////// module test.moduleB;

//import test.moduleC: funcC; //this works

public void funcB () { import test.moduleC: funcC; //linker error funcC();

return; }

///////////// module test.moduleC;

public void funcC () { return; }

/////////////

C:\dmd2\windows\bin\rdmd.exe moduleA.d //no errors, moduleA.exe created

C:\dmd2\windows\bin\rdmd.exe -g moduleA.d Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html C:\Users\user\AppData\Local\Temp.rdmd\rdmd-moduleA.d-D3D7676836384146D1D9D907CF20EC26\objs\moduleA.exe.obj(moduleA.exe) Error 42: Symbol Undefined _D4test7moduleC5funcCFZv --- errorlevel 1

Problem disappear, then i move import in test.modileB to global level:

///////////// module test.moduleB;

import test.moduleC: funcC; //this works

public void funcB () { //import test.moduleC: funcC; //linker error funcC();

return; } /////////////

Attached file: rdmd_import_bug.zip (application/x-zip-compressed, 822 bytes) Description: reduced test case (see moduleB import)

wilzbach commented 8 years ago

Comment author: Alexey G <golovanov_alexey@mail.ru>

RDMD in both cases produces same rdmd.deps file in corresponding work dir. And those rdmd.deps not contains any mention of moduleC.

Command dmd -deps=moduleA.deps moduleA.d produces moduleA.deps file, which not contains any mention of moduleC too.

Is this DMD bug instead of RDMD ?

wilzbach commented 8 years ago

Comment author: Alexey G <golovanov_alexey@mail.ru>

It seems this is old DMD bug "https://issues.dlang.org/show_bug.cgi?id=7016 - local import does not create -deps dependency"

wilzbach commented 7 years ago

Comment author: Alexey G <golovanov_alexey@mail.ru>

No. Issue 7016 fixed, but this 15533 sill exists.

DMD32 D Compiler v2.075.0-master-f546675. Reduced test case.

C:\dmd2\windows\bin\rdmd.exe moduleA.d //no errors, moduleA.exe created

C:\dmd2\windows\bin\rdmd.exe -g moduleA.d OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html C:\Users\gav\AppData\Local\Temp.rdmd\rdmd-moduleA.d-8C1729D9769E4E70D93C65D738058ED2\objs\moduleA.exe.obj(moduleA.exe)

Error 42: Symbol Undefined _D4test7moduleC5funcCFZv Error: linker exited with status 1