www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compiler not compiling properly, causing weird errors

reply Bisse <dj.bisse gmail.com> writes:
I'm using the latest stable version of DMD (1.015) along with Bud 3.04 and
Derelict. I'm making an application using SDL and OpenGL and it's been working
great so far, except that i'm getting horribly weird compiler-related errors.

For example, I can be working on one part of the application, and suddenly an
entirely different part of it starts not working. Mostly it's Access
violations, but it can be other weird stuff too. After having encountered
about 20 too many of these weird errors and solving them the same way every
time, this is what I now do mostly every time I compile, and EVERY time I get
any sort of error: I delete all the files created by the compiler - .obj,
.exe, .map, .ksp, .rsp, and whatever else it makes. Then I recompile. Poof,
the error is gone. It will also solve errors like the linker complaining it
can't find a certain symbol, and similiar.

I'll also sometimes get errors which force me to restructure/rewrite my code.
For example, after half an hour I managed to pinpoint an Access violation to
being caused by a function being CALLED - irrelevant of the argument sent to
it, at certain points in the code, the function would simply crash the
application if called. I didn't use it very often so taking the code out of
the function and CTRL-C'ing it into where I used it removed the crash entirely.

It's gotten to the point where I simply can't trust the compiler to compile my
program correctly without putting arvitrary bugs into it - When I get an error
I can't be sure if it's my fault or the compiler's fault. Please, if anyone
knows what could cause this, or has experienced anything similiar, i'll be
really happy for all the help I can get
Dec 08 2007
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Bisse" <dj.bisse gmail.com> wrote in message 
news:fjfl47$1f7c$1 digitalmars.com...
 I'm using the latest stable version of DMD (1.015) along with Bud 3.04 and
 Derelict. I'm making an application using SDL and OpenGL and it's been 
 working
 great so far, except that i'm getting horribly weird compiler-related 
 errors.

 For example, I can be working on one part of the application, and suddenly 
 an
 entirely different part of it starts not working. Mostly it's Access
 violations, but it can be other weird stuff too. After having encountered
 about 20 too many of these weird errors and solving them the same way 
 every
 time, this is what I now do mostly every time I compile, and EVERY time I 
 get
 any sort of error: I delete all the files created by the compiler - .obj,
 .exe, .map, .ksp, .rsp, and whatever else it makes. Then I recompile. 
 Poof,
 the error is gone. It will also solve errors like the linker complaining 
 it
 can't find a certain symbol, and similiar.

 I'll also sometimes get errors which force me to restructure/rewrite my 
 code.
 For example, after half an hour I managed to pinpoint an Access violation 
 to
 being caused by a function being CALLED - irrelevant of the argument sent 
 to
 it, at certain points in the code, the function would simply crash the
 application if called. I didn't use it very often so taking the code out 
 of
 the function and CTRL-C'ing it into where I used it removed the crash 
 entirely.

 It's gotten to the point where I simply can't trust the compiler to 
 compile my
 program correctly without putting arvitrary bugs into it - When I get an 
 error
 I can't be sure if it's my fault or the compiler's fault. Please, if 
 anyone
 knows what could cause this, or has experienced anything similiar, i'll be
 really happy for all the help I can get
First of all, the "latest stable version" is something of a myth. 1.024 is, as far as I can tell, perfectly stable, or at least no less stable than any version before it. Newer versions also have more bugs fixed. You can get the newest version by looking at the change log and clicking on the appropriate version. Secondly, your odd problems -- crashing in the middle of functions for no apparent reason -- are you using the -cov flag? I've had some issues with DMD emitting bad code for the coverage counters, trying to increment bogus memory locations instead of the correct counter. Of course, I haven't been able to ever make a reproduceable test case, and it only seems to happen with large programs.. Lastly, I haven't heard of crashes being caused by it, but keeping object files around when using DMD is probably not the best idea. There are usually linking issues. It seems to vastly prefer compiling everything all at once every time (and it's not slow either). To that end you'd probably be better served by using either the -full or -clean flags with Bud.
Dec 08 2007
prev sibling parent "Vladimir Panteleev" <thecybershadow gmail.com> writes:
On Sun, 09 Dec 2007 04:49:44 +0200, Bisse <dj.bisse gmail.com> wrote:

 I'm using the latest stable version of DMD (1.015) along with Bud 3.04 and
 Derelict. I'm making an application using SDL and OpenGL and it's been working
 great so far, except that i'm getting horribly weird compiler-related errors.

 For example, I can be working on one part of the application, and suddenly an
 entirely different part of it starts not working. Mostly it's Access
 violations, but it can be other weird stuff too. After having encountered
 about 20 too many of these weird errors and solving them the same way every
 time, this is what I now do mostly every time I compile, and EVERY time I get
 any sort of error: I delete all the files created by the compiler - .obj,
 .exe, .map, .ksp, .rsp, and whatever else it makes. Then I recompile. Poof,
 the error is gone. It will also solve errors like the linker complaining it
 can't find a certain symbol, and similiar.

 I'll also sometimes get errors which force me to restructure/rewrite my code.
 For example, after half an hour I managed to pinpoint an Access violation to
 being caused by a function being CALLED - irrelevant of the argument sent to
 it, at certain points in the code, the function would simply crash the
 application if called. I didn't use it very often so taking the code out of
 the function and CTRL-C'ing it into where I used it removed the crash entirely.

 It's gotten to the point where I simply can't trust the compiler to compile my
 program correctly without putting arvitrary bugs into it - When I get an error
 I can't be sure if it's my fault or the compiler's fault. Please, if anyone
 knows what could cause this, or has experienced anything similiar, i'll be
 really happy for all the help I can get
If you use -inline, you have to rebuild all code from scratch. Dependencies can't be tracked correctly when code is inlined across modules. -- Best regards, Vladimir mailto:thecybershadow gmail.com
Dec 10 2007