April 07, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=424





------- Comment #8 from someanon@yahoo.com  2007-04-06 21:28 -------
Tried the new linker:

http://ftp.digitalmars.com/Digital_Mars_C++/Patch/beta.zip

In release mode (-d -O -inline -release), it works, and generate the exe file.
But when running the program (using wxd, 0.09 version), the main UI window
doesn't show up.

In debug mode (-d -g -gc -debug), it errors out:
Unexpected OPTLINK Termination at EIP=00412793

GDC (under MingW32) works in both debug & release mode on the same system.


-- 

September 12, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=424





------- Comment #9 from davidl@126.com  2007-09-12 08:20 -------
I think if you can post your object file which makes optlink fails could let Walter easier to debug this issue


-- 

November 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=424





------- Comment #10 from wbaxter@gmail.com  2007-11-14 18:55 -------
(In reply to comment #1)
> While important, I don't think it's a blocker. 30,000 lines of code in one module is unusually large, and can be split into smaller source files.

I believe I'm running into this too, and my files have a reasonable number of lines.  However, the code is structured so that *everything* is templated, and doesn't get instantiated until main.d.  This is a very common way to write heavily generic code.  The actual library in question in which this is happening OpenMeshD (http://www.dsource.org/projects/openmeshd), which is a port of a  C++ template library to D.

Why I think I'm seeing this same problem:

1) Optlink is dying and popping up a MsgBox saying "Unexpected OPTLINK Termination at EIP=0044C37B"  The EIP number is different that the one previously reported, but I'm guessing that doesn't matter (just a random memory address?).

2) The thing that triggered the crashing was adding a function with a big block
of type-checking case statements like this:
   else if (ti==typeid(VectorT!(byte,   2))) {
       renderer_ = new PropRenderer!(VectorT!(byte,   2));
   }

   So it's causing a lot of templates to be instantiated, which could be
pushing the number of "fixups" in main.d over the 16K limit.

3) If I start commenting out those "else if" lines one by one, eventually compilation will work again. It doesn't seem to matter which lines I comment out.  If I get rid of enough of them, then it compiles.

4) Compiling with -O -release instead of -g -debug allows me to uncomment a few more of the lines.

5) "main.obj" is between 1-2MB even in release mode.

All that seems to add up to an OPTLINK upper limit bug.  If not with # of fixups then with something.

I'm using DMD 1.023 on Windows XP.

I've checked the code into the OpenMesh/D repository in its buggy state so it can be checked out for debugging.

To reproduce, check out revision 111 of OpenMesh from the svn repository:

If you don't have dsss installed, install it first
(http://www.dsource.org/projects/dsss)

Then:

$ mkdir scratch
$ cd scratch
$ svn co -r111 http://svn.dsource.org/projects/openmeshd/trunk .
$ cd OpenMeshD\OpenMesh\Apps\GLViewer
$ dsss net deps
$ dsss build -version=OPTLINKIsMyFriend

If there are complaints about Helix things, you may need to go to the Helix dir and do a "dsss build && dsss install"


-- 

November 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=424


wbaxter@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major




------- Comment #11 from wbaxter@gmail.com  2007-11-14 23:37 -------
Upgrading the severity because I just ran into this again adding to an unrelated part of the main .d file.  Moving the added code to a different file fixed it for now but that may not always be so easy to do if the code needs to be in the generic, templated part of things.  Then it seems it will end up instantiating in the main .obj file no matter where I put it.

Also further rearrangement of the code started triggering the "previous definition different blahblah_initZ" bug.

So, yeh, this is a bad one, and it affects more than just code with gigantic source files.   It appears to affect any template library with a few tens of thousands of lines of code.


-- 

March 05, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=424





------- Comment #12 from wbaxter@gmail.com  2008-03-04 21:25 -------
Fun fun!  Just hit this one again.

See thread digitalmars.com digitalmars.D:67093


-- 

June 26, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=424


wbaxter@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Unexpected OPTLINK          |Unexpected OPTLINK
                   |Termination at EIP=0044C37B |Termination at EIP=0044C37B
                   |                            |(too many fixups)




------- Comment #13 from wbaxter@gmail.com  2008-06-26 18:24 -------
Changed title to include keyword "fixups" for easy finding.


-- 

November 13, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=424





------- Comment #14 from samukha@voliacable.com  2008-11-13 00:54 -------
Probably a duplicate of #2436 or/and #1439


-- 

November 13, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=424





------- Comment #15 from wbaxter@gmail.com  2008-11-13 02:00 -------
(In reply to comment #14)
> Probably a duplicate of #2436 or/and #1439
> 

Er, I think you mean #2436 and/or #1439 are probably duplicates of this one.


-- 

November 13, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=424





------- Comment #16 from samukha@voliacable.com  2008-11-13 03:05 -------
Exactly


-- 

November 21, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=424





------- Comment #17 from jarrett.billingsley@gmail.com  2008-11-20 18:26 -------
Just got bitten by this one too.  Voted!


--