www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4009] New: OPTLINK ruins the day yet again

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

           Summary: OPTLINK ruins the day yet again
           Product: D
           Version: future
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Optlink
        AssignedTo: nobody puremagic.com
        ReportedBy: nfxjfg gmail.com


--- Comment #0 from nfxjfg gmail.com 2010-03-26 04:27:51 PDT ---
Compile the following source code with dmd x.d -g

OPTLINK will crash:

Unexpected OPTLINK Termination at EIP=0041338F

EAX=6F733231 EBX=6F733231 ECX=00000000 EDX=1D8CC66F
ESI=0033FE7C EDI=1D8CC66F EBP=0033FED4 ESP=0033FD60
First=0042000

(copied by hand)

It doesn't crash without -g. It doesn't crash when you reduce the number of
template instantiations, or reduce the references to instantiated templates
(you can vary these by changing the numbers in the program).

Bug 3870 is probably the same bug, but I can't possibly know (the register
contents are completely different).

The test case works perfectly fine on Linux.

---- this is file x.d:
template Tuple(T...) {
    alias T Tuple;
}

template Repeat(int count) {
    static if (!count) {
        alias Tuple!() Repeat;
    } else {
        alias Tuple!(count-1, Repeat!(count-1)) Repeat;
    }
}

void sometemplate(int T)() {
    foreach (x; Repeat!(62)) {
        sometemplate!(T)();
    }
}

void main() {
    foreach (x; Repeat!(298)) {
        sometemplate!(x)();
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 26 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4009



--- Comment #1 from nfxjfg gmail.com 2010-03-29 18:18:20 PDT ---
Funny thing: if I name _exactly_ the same file x2.d, OPTLINK doesn't crash!

copy x.d x2.d
dmd x.d -g      -- OPTLINK crashes
dmd x2.d -g     -- OPTLINK doesn't crash

Let me repeat: this bug is not reproduceable if you change the filename.

Makes me wonder what the flying fuck is going on.

(Maybe I should mention that I did this under wine on Linux, but I also had
someone reproduce the crash on a real Windows.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 29 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4009


Max Samukha <samukha voliacable.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha voliacable.com


--- Comment #2 from Max Samukha <samukha voliacable.com> 2010-03-30 00:32:55
PDT ---
I think it has something to do with module names being part of symbol names.
When you change the file name the symbol names change as well.

FWIW, my development branch of QtD (compiled with dmd 2.042) doesn't link on
Windows. This bug may be the cause.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 30 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4009



--- Comment #3 from nfxjfg gmail.com 2010-05-07 06:00:12 PDT ---
In dmd 1.060, the example above doesn't crash anymore, but this does:
------- x.d
template Tuple(T...) {
    alias T Tuple;
}

template Repeat(int count) {
    static if (!count) {
        alias Tuple!() Repeat;
    } else {
        alias Tuple!(count-1, Repeat!(count-1)) Repeat;
    }
}

void sometemplate(int T)() {
    foreach (x; Repeat!(320)) {
        sometemplate!(T)();
    }
}

void main() {
    foreach (x; Repeat!(498)) {
        sometemplate!(x)();
    }
}
-------
wine dmd x.d -g

Unexpected OPTLINK Termination at EIP=0041338F

EAX=0200000A EBX=0200000A ECX=00000000 EDX=65D474DD
ESI=0033FE7C EDI=65D474DD EBP=0033FED4 ESP=0033FD60
First=00402000

There's lots of similarities in the test case and register dump, so I suppose
it's the same bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 07 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4009


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |link-failure
           Priority|P2                          |P1


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 07 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4009



--- Comment #4 from nfxjfg gmail.com 2010-05-31 13:09:20 PDT ---
Does anyone know what Walter thinks about this?
When can we expect a fix?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 31 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4009


Eldar Insafutdinov <e.insafutdinov gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |e.insafutdinov gmail.com


--- Comment #5 from Eldar Insafutdinov <e.insafutdinov gmail.com> 2010-05-31
13:20:31 PDT ---
(In reply to comment #4)
 Does anyone know what Walter thinks about this?
 When can we expect a fix?
Same question. This bug(or a similar one) has been a pain for building QtD on Windows. It occurs or it doesn't depending on some unrelated factors. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 31 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4009


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #6 from Walter Bright <bugzilla digitalmars.com> 2010-08-25
12:31:20 PDT ---
I can reproduce it, it appears to be related to the -g switch. The object file
is very large, it perhaps is caused by a counter overflow.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 25 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4009


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #7 from Walter Bright <bugzilla digitalmars.com> 2010-09-01
01:08:56 PDT ---
Fixed with link 8.00.6

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


Tomasz Stachowiak <h3r3tic mat.uni.torun.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |h3r3tic mat.uni.torun.pl


--- Comment #8 from Tomasz Stachowiak <h3r3tic mat.uni.torun.pl> 2010-09-01
04:07:12 PDT ---
(In reply to comment #7)
 Fixed with link 8.00.6
I haven't tested against this very example, but your latest patch also seems to fix a crash at a different EIP I've been getting since the last few days (repro too large): EIP=00425343 EAX=0001B04C EBX=00000202 ECX=00000004 EDX=01160000 ESI=0043B544 EDI=01164000 EBP=0012FFF0 ESP=0012FF7C First=00402000 If this is true and not just a random magical arrangement of electrons and planets, I might arrange a little party tonight O_O Much appreciated! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 01 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4009



--- Comment #9 from nfxjfg gmail.com 2010-09-01 10:38:34 PDT ---
It's like the fixing of bug 424 all over again!

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



--- Comment #10 from Walter Bright <bugzilla digitalmars.com> 2010-09-05
03:28:45 PDT ---
The overflow would happen when some of the data structures exceeded 128K in
size.

I checked the other seg faults for optlink in Bugzilla, but those apparently
have different causes.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 05 2010