www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DMD returns -1073741819 despite success

reply A. Jung <webmaster aj-productions.de> writes:
Since DMD 2.017, DMD returns -1073741819, despite linking was successful with
an output exe successfully generated:

"Linking executable: bin\debug\test.exe
Process terminated with status -1073741819 (0 minutes, 3 seconds)
0 errors, 0 warnings"

This causes the Codeblocks IDE to think that linking was not successful, and
subsequently does not allow me to start the debugger.
Please check this, and let it return something like 0 again.

Regards,
AJ
Apr 06 2009
next sibling parent Kagamin <spam here.lot> writes:
A. Jung Wrote:

 Since DMD 2.017, DMD returns -1073741819, despite linking was successful with
an output exe successfully generated:
 
 "Linking executable: bin\debug\test.exe
 Process terminated with status -1073741819 (0 minutes, 3 seconds)
 0 errors, 0 warnings"
 
c:\dev\d\win>\dev\dmd\bin\dmd tmp.d -I.. -oftmp.exe -w c:\dev\d\win>echo %errorlevel% 0 c:\dev\d\win>\dev\dmd\bin\link tmp.obj c:\dev\d\win>echo %errorlevel% 0
Apr 06 2009
prev sibling parent reply A. Jung <webmaster aj-productions.de> writes:
OK, now it looks like a configuration error of the Codeblocks IDE which
happenend during the transition to the new D compiler directory structure.
Still investigating...

Thanks so far.


Kagamin Wrote:

 A. Jung Wrote:
 
 Since DMD 2.017, DMD returns -1073741819, despite linking was successful with
an output exe successfully generated:
 
 "Linking executable: bin\debug\test.exe
 Process terminated with status -1073741819 (0 minutes, 3 seconds)
 0 errors, 0 warnings"
 
c:\dev\d\win>\dev\dmd\bin\dmd tmp.d -I.. -oftmp.exe -w c:\dev\d\win>echo %errorlevel% 0 c:\dev\d\win>\dev\dmd\bin\link tmp.obj c:\dev\d\win>echo %errorlevel% 0
Apr 06 2009
parent reply Kagamin <spam here.lot> writes:
A. Jung Wrote:

 OK, now it looks like a configuration error of the Codeblocks IDE which
happenend during the transition to the new D compiler directory structure.
Still investigating...
 
I keep old directory structure.
Apr 06 2009
parent reply A. Jung <webmaster aj-productions.de> writes:
After further research, I'm still convinced that this is a bug in DMD.
In your example above, you used "link.exe" to link the obj files into the final
exe. Codeblocks, however, uses "dmd.exe" to link the obj files.

This is valid and the preferred way according to the DMD docs: "Linking is done
directly by the dmd compiler after a successful compile. To prevent dmd from
running the linker, use the -c switch.".

Codeblocks generates the following expanded console output, which looks
reasonable to me:

"-------------- Build: debug in test2 ---------------

dmd.exe  -g -debug    -IC:\dmd\src\phobos  -c hello.d -ofobj\debug\hello.obj
dmd.exe bin\debug\test2.exe  obj\debug\hello.obj   phobos.lib 
Process terminated with status -1073741819 (0 minutes, 0 seconds)
0 errors, 0 warnings"

It worked worked this way before 2.017.


Kagamin Wrote:

 A. Jung Wrote:
 
 OK, now it looks like a configuration error of the Codeblocks IDE which
happenend during the transition to the new D compiler directory structure.
Still investigating...
 
I keep old directory structure.
Apr 06 2009
parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
A. Jung wrote:
 After further research, I'm still convinced that this is a bug in DMD.
 In your example above, you used "link.exe" to link the obj files into the
final exe. Codeblocks, however, uses "dmd.exe" to link the obj files.
 
 This is valid and the preferred way according to the DMD docs: "Linking is
done directly by the dmd compiler after a successful compile. To prevent dmd
from running the linker, use the -c switch.".
 
 Codeblocks generates the following expanded console output, which looks
reasonable to me:
 
 "-------------- Build: debug in test2 ---------------
 
 dmd.exe  -g -debug    -IC:\dmd\src\phobos  -c hello.d -ofobj\debug\hello.obj
 dmd.exe bin\debug\test2.exe  obj\debug\hello.obj   phobos.lib 
Shouldn't that be "dmd.exe -ofbin\debug\test2.exe ..."?
Apr 06 2009
parent reply A. Jung <webmaster aj-productions.de> writes:
Frits van Bommel Wrote:
 Shouldn't that be "dmd.exe -ofbin\debug\test2.exe ..."?
Plausible, but OTOH optlink recognizes the type of the file by looking at the file extension, e.g. .exe -> out file??? Anyway, I don't have a choice, as codeblocks doesn't allow me to customize the command line arguments. (... at least as long as I am not willing to modify the codeblocks source code). For clarification: an exe file is successfully generated, only the return value of DMD.exe is wrong.
Apr 06 2009
parent reply A. Jung <webmaster aj-productions.de> writes:
For confirmation: same input, but DMD 2.016:

"-------------- Build: debug in test2 ---------------

dmd.exe  -g -debug    -IC:\dmd\src\phobos  -c hello.d -ofobj\debug\hello.obj
dmd.exe bin\debug\test2.exe  obj\debug\hello.obj   phobos.lib 
Output size is 96.53 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings"
Apr 06 2009
parent reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
Well, for me it works.  I do use the error level in some scripts I've 
written, and it outputs 0 when linking.  I'm not linking in the lib 
file, though.

Try it from the command line.  I know you want it to work in the IDE, 
but the first step is to determine whose bug it is.  From the command 
line, just execute the commands your IDE echos, and after each issue 
echo %errorlevel%.  So:

dmd.exe  -g -debug    -IC:\dmd\src\phobos  -c hello.d -ofobj\debug\hello.obj
echo %errorlevel%
dmd.exe bin\debug\test2.exe  obj\debug\hello.obj   phobos.lib
echo %errorlevel%

If both times it returns 0, something funny is happening.  Also, 
dmd.exe's return code is directly related to link.exe's return code.

You could try using the link.exe from 2.016, and see if that works.  If 
it does, maybe there's a bug in link.exe.

If you can get a non-zero errorlevel, use dmd -v, it will output what it 
sends to link.exe... see if that command also gives the same errorlevel.

-[Unknown]


A. Jung wrote:
 For confirmation: same input, but DMD 2.016:
 
 "-------------- Build: debug in test2 ---------------
 
 dmd.exe  -g -debug    -IC:\dmd\src\phobos  -c hello.d -ofobj\debug\hello.obj
 dmd.exe bin\debug\test2.exe  obj\debug\hello.obj   phobos.lib 
 Output size is 96.53 KB
 Process terminated with status 0 (0 minutes, 0 seconds)
 0 errors, 0 warnings"
Apr 07 2009
parent reply A. Jung <webmaster aj-productions.de> writes:
Unknown W. Brackets Wrote:
 Try it from the command line.
DMD 2.016: D:\test2>batmake D:\test2>dmd.exe -g -debug -IC:\dmd\src\phobos -c hello.d -ofobj\debug\hello.obj D:\test2>echo 0 0 D:\test2>dmd.exe bin\debug\test2.exe obj\debug\hello.obj phobos.lib D:\test2>echo 0 0" DMD 2.017: "D:\test2>batmake D:\test2>dmd.exe -g -debug -IC:\dmd\src\phobos -c hello.d -ofobj\debug\hello.obj D:\test2>echo 0 0 D:\test2>dmd.exe bin\debug\test2.exe obj\debug\hello.obj phobos.lib D:\test2>echo -1073741819 -1073741819" This has nothing to do with Codeblocks or directory structure. I suspect, this is probably related to the new mulithreading feature of DMD. I am running an "Intel(R) Core(TM)2 Quad CPU". Next, I'll try DMD2.017 with LINK2.016.
Apr 07 2009
parent reply A. Jung <webmaster aj-productions.de> writes:
Now DMD2.017 with LINK2.016:

"D:\test2>batmake

D:\test2>dmd --help
Digital Mars D Compiler v2.027

[...]

D:\test2>link -H
OPTLINK (R) for Win32  Release 8.00.1

[...]

D:\test2>dmd.exe  -g -debug    -IC:\dmd\src\phobos  -c hello.d
-ofobj\debug\hello.obj

D:\test2>echo 0
0

D:\test2>dmd.exe bin\debug\test2.exe  obj\debug\hello.obj   phobos.lib -v
C:\dmd\windows\bin\link.exe "obj\debug\hello","bin\debug\test2.exe",,"phobos.lib
"+user32+kernel32/noi;

D:\test2>echo -1073741819
-1073741819"

So its LINK.exe!
Apr 07 2009
parent reply A. Jung <webmaster aj-productions.de> writes:
A. Jung Wrote:
 So its LINK.exe!
Sorry, fingertrouble. Its definitly DMD.exe. Following happens when doing a fresh install of the entire DMD2.017 package and then replacing DMD.exe with the one from 2.016: "D:\test2>batmake D:\test2>dmd.exe -g -debug -IC:\dmd\src\phobos -c hello.d -ofobj\debug\hello.obj D:\test2>echo 0 0 D:\test2>dmd.exe bin\debug\test2.exe obj\debug\hello.obj phobos.lib -v C:\dmd\windows\bin\link.exe "obj\debug\hello","bin\debug\test2.exe",,"phobos.lib "+user32+kernel32/noi; D:\test2>echo 0 0"
Apr 07 2009
parent A. Jung <webmaster aj-productions.de> writes:
Issue persists with DMD2.018.

Should I file this as a bug (?), or is anybody willing check this on a
multicore machine and take care of it???
Apr 08 2009