www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11114] New: Undefined symbols after merging dmd pull #2550

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


           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: link-failure
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com



12:25:50 MSD ---

errors for some templates.

The project builds fine before the pull. Application is in `levelling` package,
other package are libs it is linked with. OPTLINK errors just after merging,
symbols are demangled using VisualD:
----------
Debug\Levelling.obj(Levelling) 
 Error 42: Symbol Undefined
_D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel6__ctorMFNfC6metaui8controls9container16ContainerControlAC6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5PanelXC6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel
( safe
metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel
metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.__ctor(metaui.controls.container.ContainerControl,
metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel[]...))
Debug\Levelling.obj(Levelling) 
 Error 42: Symbol Undefined
_D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel6sourceMNgFNaNbNdNfZNgC9levelling14LevFileManager14LevFileManager
(metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.sourceinout(pure
nothrow  property  safe inout(levelling.LevFileManager.LevFileManager)
function()))
Debug\Levelling.obj(Levelling) 
 Error 42: Symbol Undefined
_D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel6__ctorMFNaNfC6metaui8controls9container16ContainerControlZC6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel
(pure  safe
metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel
metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.__ctor(metaui.controls.container.ContainerControl))
Debug\Levelling.obj(Levelling) 
 Error 42: Symbol Undefined
_D3std10functional28__T8unaryFunVAyaa4_74727565Z40__T8unaryFunTC4gtkd3gtk8controls6WidgetZ8unaryFunFNaNbNfC4gtkd3gtk8controls6WidgetZb
(pure nothrow  safe bool
std.functional.unaryFun!("true").unaryFun!(gtkd.gtk.controls.Widget).unaryFun(gtkd.gtk.controls.Widget))
Debug\Levelling.obj(Levelling) 
 Error 42: Symbol Undefined
_D5unstd5casts95__T6upCastTC11levellingui6native10GTKContext10GTKContextTC11levellingui6panels7context7ContextZ6upCastFNaNbNdNfNgC11levellingui6panels7context7ContextZNgC11levellingui6native10GTKContext10GTKContext
(pure nothrow  property  safe inout(levellingui.native.GTKContext.GTKContext)
unstd.casts.upCast!(levellingui.native.GTKContext.GTKContext,
levellingui.panels.context.Context).upCast(inout(levellingui.panels.context.Context)))
Debug\Levelling.obj(Levelling) 
 Error 42: Symbol Undefined
_D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel6sourceMFNdNfC9levelling14LevFileManager14LevFileManagerZv
( property  safe void
metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.source(levelling.LevFileManager.LevFileManager))
Debug\Levelling.obj(Levelling) 
 Error 42: Symbol Undefined
_D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel20setTypedSourceObjectMFNaNfC6ObjectZv
(pure  safe void
metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.setTypedSourceObject(Object))
--- errorlevel 7
----------
Also see Issue 10920 which looks similar but isn't a "regression" so I created
a new one.


[1] https://github.com/D-Programming-Language/dmd/pull/2550

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




12:46:03 MSD ---
And the funny thing is: all libraries builds fine and works with latest HEAD.
The only thing I have to build without the pull is the final executable.

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




Could you please post the reduced test case? Posting just only error messages
cannot help for fixing the regression.

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




10:44:17 MSD ---

 Could you please post the reduced test case? Posting just only error messages
 cannot help for fixing the regression.
I'd post if I could. Sorry, but I doesn't look possible. Too much code and no obvious auto-reduction criteria. Maybe this will give some info: Here is a module: --- import document.interfaces; import metaui.controls.panel; import levelling.LevFileManager; void f(Panel!IFileManager pnl1, Panel!LevFileManager pnl2) { pnl1.addSubPanel(pnl2, fileMgr => cast(LevFileManager) fileMgr); // line A pnl2.source = null; // line B } --- There are other modules where these Panel!T templates are used. If line A is commented - project builds. If not but line B is commented we get 4 error: ---------- Debug\Levelling.obj(Levelling) Error 42: Symbol Undefined _D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel6__ctorMFNfC6metaui8controls9container16ContainerControlAC6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5PanelXC6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel ( safe metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.__ctor(metaui.controls.container.ContainerControl, metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel[]...)) Debug\Levelling.obj(Levelling) Error 42: Symbol Undefined _D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel6sourceMNgFNaNbNdNfZNgC9levelling14LevFileManager14LevFileManager (metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.sourceinout(pure nothrow property safe inout(levelling.LevFileManager.LevFileManager) function())) Debug\Levelling.obj(Levelling) Error 42: Symbol Undefined _D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel6__ctorMFNaNfC6metaui8controls9container16ContainerControlZC6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel (pure safe metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.__ctor(metaui.controls.container.ContainerControl)) Debug\Levelling.obj(Levelling) Error 42: Symbol Undefined _D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel20setTypedSourceObjectMFNaNfC6ObjectZv (pure safe void metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.setTypedSourceObject(Object)) --- errorlevel 4 ---------- If line B is also uncommented we get one more error: ---------- ... Debug\Levelling.obj(Levelling) Error 42: Symbol Undefined _D6metaui8controls5panel54__T5PanelTC9levelling14LevFileManager14LevFileManagerZ5Panel6sourceMFNdNfC9levelling14LevFileManager14LevFileManagerZv ( property safe void metaui.controls.panel.Panel!(levelling.LevFileManager.LevFileManager).Panel.source(levelling.LevFileManager.LevFileManager)) Debug\Levelling.obj(Levelling) ... --- errorlevel 5 ---------- I can also provide remote access to my PC if someone needed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114




11:19:48 MSD ---
OK. Sorry, I haven't checked issues and latest pulls. This looks like a dup of

errors. The only rest error is:
----------
 Error 42: Symbol Undefined
_D5unstd5casts95__T6upCastTC11levellingui6native10GTKContext10GTKContextTC11levellingui6panels7context7ContextZ6upCastFNaNbNdNfNgC11levellingui6panels7context7ContextZNgC11levellingui6native10GTKContext10GTKContext
(pure nothrow  property  safe inout(levellingui.native.GTKContext.GTKContext)
unstd.casts.upCast!(levellingui.native.GTKContext.GTKContext,
levellingui.panels.context.Context).upCast(inout(levellingui.panels.context.Context)))
----------

So I'd say Issue 11069 isn't fully fixed.

[1] 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 25 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114





 So I'd say Issue 11069 isn't fully fixed.
OK, I checked compiler code on desk, and found two suspicious code places. Could you test this patch on git head (da3d2e6)? src/template.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/template.c b/src/template.c index b7c58ca..a4f67f3 100644 --- a/src/template.c +++ b/src/template.c -1122,10 +1122,8 MATCH TemplateDeclaration::deduceFunctionTemplateMatch(FuncDeclaration *f, Loc l paramsym->parent = scope->parent; Scope *paramscope = scope->push(paramsym); - paramscope->instantiatingModule = sc->instantiatingModule; Module *mi = sc->instantiatingModule ? sc->instantiatingModule : sc->module; - if (!sc->instantiatingModule || sc->instantiatingModule->isRoot()) - paramscope->instantiatingModule = mi; + paramscope->instantiatingModule = mi; paramscope->callsc = sc; paramscope->stc = 0; -2640,7 +2638,8 FuncDeclaration *TemplateDeclaration::doHeaderInstantiation(Scope *sc, ti->argsym = new ScopeDsymbol(); ti->argsym->parent = scope->parent; scope = scope->push(ti->argsym); - scope->instantiatingModule = sc->instantiatingModule; + Module *mi = sc->instantiatingModule ? sc->instantiatingModule : sc->module; + scope->instantiatingModule = mi; bool hasttp = false; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114




19:54:38 MSD ---


 So I'd say Issue 11069 isn't fully fixed.
OK, I checked compiler code on desk, and found two suspicious code places. Could you test this patch on git head (da3d2e6)?
Thanks, but same failure occurs with the patch. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114





https://github.com/D-Programming-Language/dmd/pull/2590



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




11:55:22 MSD ---


 https://github.com/D-Programming-Language/dmd/pull/2590
 

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



02:15:32 PDT ---
Denis, we're going to need some more help with this, i.e. code we can compile
that duplicates the error.

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




2013-10-08 16:11:08 MSD ---

 Denis, we're going to need some more help with this, i.e. code we can compile
 that duplicates the error.
The project is not open source so I can't post it here. But as I trust dmd developers you can e-mail me (shown here address but better without ".reg" suffix) and I will prepare and send the testcase privately. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114




16:12:34 PDT ---
This may fix it:

https://github.com/D-Programming-Language/dmd/pull/2661

Need to also check if imports are compiled with one -version while the importer
is compiled with another -version.

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




2013-10-14 09:40:59 MSD ---

 This may fix it:
 
 https://github.com/D-Programming-Language/dmd/pull/2661
Why "may"? It will definitely workaround at in debug mode as it disables symbol discarding at all and will have no effect in no-debug mode. This issue isn't related to "-debug" switch.
 Need to also check if imports are compiled with one -version while the importer
 is compiled with another -version.
Not possible. The whole final project is compiled in single dmd call. Just one of the templates it instantiate is assumed by the compiler to belong to one of imported libraries and thus discarded in `FuncDeclaration::toObjFile`. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114




12:43:38 PDT ---


 This may fix it:
 
 https://github.com/D-Programming-Language/dmd/pull/2661
Why "may"?
Because I haven't checked your case, so I don't know if it is the same issue or not.
 Need to also check if imports are compiled with one -version while the importer
 is compiled with another -version.
Not possible. The whole final project is compiled in single dmd call. Just one of the templates it instantiate is assumed by the compiler to belong to one of imported libraries and thus discarded in `FuncDeclaration::toObjFile`.
I'm asking if the reason, in your code, it isn't in the imported libraries is because it is behind a version declaration? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114




2013-10-14 23:49:23 MSD ---

 I'm asking if the reason, in your code, it isn't in the imported libraries is
 because it is behind a version declaration?
Impossible. The symbol belongs to the final executable-compiled project (it is a template from the library instantiated with project's own types) which is compiled in a single dmd call as I already have written. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114




14:16:14 PDT ---


 I'm asking if the reason, in your code, it isn't in the imported libraries is
 because it is behind a version declaration?
Impossible. The symbol belongs to the final executable-compiled project (it is a template from the library instantiated with project's own types) which is compiled in a single dmd call as I already have written.
If it is compiled in one a single dmd call, then it wouldn't be linking in other libraries? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114




2013-10-15 05:43:47 MSD ---



 I'm asking if the reason, in your code, it isn't in the imported libraries is
 because it is behind a version declaration?
Impossible. The symbol belongs to the final executable-compiled project (it is a template from the library instantiated with project's own types) which is compiled in a single dmd call as I already have written.
If it is compiled in one a single dmd call, then it wouldn't be linking in other libraries?
It links in other libraries. But other libraries can't contain symbols consisting of types they don't know about. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11114




13:39:04 PDT ---
Can you please try this with the new -allinst switch?

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




2013-10-27 02:12:55 MSD ---

 Can you please try this with the new -allinst switch?
I have already written few times where exactly is the problem. So `-allinst` on final executable build workarounds the issue just like all other such issues with incorrect `instantiatingModule`. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 26 2013