digitalmars.D.bugs - [Issue 3274] New: dmd fails to emit code for templates into object file if several files are compiled at once
- d-bugmail puremagic.com Aug 30 2009
- d-bugmail puremagic.com Jan 06 2011
- d-bugmail puremagic.com Jan 06 2011
- d-bugmail puremagic.com Apr 04 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3274 Summary: dmd fails to emit code for templates into object file if several files are compiled at once Product: D Version: 1.046 Platform: Other OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: nfxjfg gmail.com If you compile several files at once, and the files instantiate the same template, dmd outputs the code for that template only into one object file. This breaks incremental compilation with tools like rebuild/dsss. ldc doesn't suffer from this bug, and outputs the template code into all corresponding object files. Reproduction of that bug: First put the files listed at the end of the bug report into a.d, b.d and c.d. Then execute these steps (order of files is important): 1. dmd a.d b.d c.d -c -version=XX 2. dmd a.d -c (without version XX -> like a change to the source code; because b.d and c.d don't depend from a.d, you shouldn't need to recompile it.) 3. dmd a.o b.o c.o Step 3 gives the error: b.o: In function `_D1b1xFZv': b.d:(.text._D1b1xFZv+0x4): undefined reference to `_D1c13__T6from_cTiZ6from_cFZv' collect2: ld returned 1 exit status --- errorlevel 1 If Step 2. is left out, the error doesn't happen. If you compile all files separately in Step 1, the error doesn't happen. -- file a.d: module a; import b; import c; void main() { version (XX) { from_c!(int)(); } } -- file b.d: module b; import c; void x() { from_c!(int)(); } -- file c.d: module c; void from_c(T)() { } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 30 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3274 nfxjfg gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3274 Brad Roberts <braddr puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |braddr puremagic.com Resolution|WONTFIX | -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3274 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED CC| |bugzilla digitalmars.com Resolution| |WONTFIX --- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2011-04-04 23:17:05 PDT --- The compiler does this as a compile performance optimization. Otherwise, template instantiations have to be done over and over, filling the object files, and then the linker has to remove the duplicates. The workaround for an incremental build system is straightforward - put only one source module on a command to dmd at a time. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 04 2011









d-bugmail puremagic.com 