#1 dmd executable works, gdc executable seg. faults

closed
nobody
None
5
2007-07-07
2007-06-04
j_house
No

I'm having a very tough time tracking down whatever is going wrong with my project, and I'm starting to suspect it may be an issue with gdc. I'd like to get tips on how to prove or disprove this.

I've compiled the project on four different computers. Two were windows, one was a mac, and on was an amd64x2. The latter two don't support dmd and so only gdc was used. Both windows boxes used dmd and one used gdc as well.

Both dmd compilations run without problem.
All three gdc compilations crash with platform specific errors.
amd64x2 (ubuntu 7.04) - segmentation fault
mac - bus error
windows - application error

I've done most of my debug effort on the amd64x2.

I caught the error in GDB a number of times. I had to go up the stack a few to get to my code, and when examining the code and the various variables it used, I could find nothing wrong.

While the literal crash occurred when leveraging a lot of code in the project, I was able to get valgrind to report an issue early on, and in the same module that eventually had the crash. I had thought I was on to something.

Using valgrind as a guide, I boiled a unit test down to the following:
T a = new T();
T b = a.dup; // My own dup command
b = a.dup;

When I ran valgrind, it did not find anything wrong with a.dup the first time, but the second a.dup generated lots of "execution based on uninitialized memory" errors (or something worded very similarly). The module was almost 100% detachable and so I copied the entire file, added a main and disabled one import. When the modified file was run through valgrind again, no warnings or errors of any kind were generated.

I can provide extra detail, included instructions on obtaining, building, and executing the project if desired.

I'm at a loss as to how to track this down further. Please let me know what I should do next.

Discussion

  • David Friedman

    David Friedman - 2007-06-06

    Logged In: YES
    user_id=1378044
    Originator: NO

    There are some ABI differences between GDC and DMD. These are explained in the manual. If you are doing any low-level operations, I suggest tracing through the code in a debugger and verifying it is doing what you expect.

     
  • j_house

    j_house - 2007-06-08

    Logged In: YES
    user_id=1353569
    Originator: YES

    I found http://dgcc.sourceforge.net/gdc/manual.html, but I don't see any specific ABI documentation differences. The closest thing I find from there is "dstress" at http://dstress.kuehne.cn/www/dstress.html. I also found documentation (somewhere) on AA differences.

    I'm definitely using AA's and typeinfo. The AA differences page didn't look like anything I was doing. I tried commenting out all of the typeinfo stuff, but the problem remained.

    From dstress, I think the remaining things to look at are my uses of delegates and tuples. I use lots and lots of delegates... They're for interprocess communication. Delegates are also used fairly extensively in foreach loops.

    Am I missing any places to look for clues?

     
  • j_house

    j_house - 2007-07-07

    Logged In: YES
    user_id=1353569
    Originator: YES

    This turns out to be extreme instability of the garbage collector. I can mitigate the effect by reducing the allocations/deallocations in the program, but a crash will still occur.

     
  • j_house

    j_house - 2007-07-07
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks