www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GG bug? (OS X Lion, DMD 2.054)

reply Magnus Lie Hetland <magnus hetland.org> writes:
I upgraded from OS X Snow Leopard to Lion recently (on a 32-bit iMac), 
and when I tried to run my D code afterward, I suddenly ran into all 
kinds of interesting problems (lots of failed assertions in my tests, 
and bus errors in my actual runs...). Still cleaning stuff up, but I've 
isolated at least one thing that seems to be a bug, and that wasn't 
there before I upgraded.

Now, I upgraded from DMD 2.052 to 2.054 before doing any extensive 
debugging, so I'm not 100% sure this specific problem was there in 
2.052 as well, but I *think* so (i.e., making the switch to Lion the 
triggering factor).

Anyway, here's some code:

import std.exception, core.memory;

class Foo {
    bool bar;
}

void main() {
    auto f = new Foo;
    f.bar = true;
    //GC.collect();
    enforce(f.bar);
}

Works well, unless you uncomment the GC call, in which case a bus error 
occurs (at least for me). Seems the collector is a bit over-eager...?

-- 
Magnus Lie Hetland
http://hetland.org
Aug 03 2011
next sibling parent Magnus Lie Hetland <magnus hetland.org> writes:
Note that an explicit call to GC.collect isn't necessary. Whenever 
collection occurs, the collectors seems rather indiscriminate, 
collecting things it shouldn't, resulting in bus errors. When I disable 
the GC, my code runs just fine. (My production code, that is. There are 
still mysterious, probably Lion-related, bugs in my test suite...)

-- 
Magnus Lie Hetland
http://hetland.org
Aug 03 2011
prev sibling parent reply David Nadlinger <see klickverbot.at> writes:
On 8/3/11 4:07 PM, Magnus Lie Hetland wrote:
 I upgraded from OS X Snow Leopard to Lion recently (on a 32-bit iMac),
 and when I tried to run my D code afterward, I suddenly ran into all
 kinds of interesting problems (lots of failed assertions in my tests,
 and bus errors in my actual runs...).
This seems to be exactly same problem I reported to the NG some days ago. It is caused by ASLR being enabled for 32bit applications on Lion too, and kennytm is to be credited for tracking this down to a fixed stack bottom in the druntime code: https://github.com/D-Programming-Language/druntime/pull/43. The fix has already been merged into master, please use that for OS X development until the next DMD release. David
Aug 03 2011
next sibling parent Magnus Lie Hetland <magnus hetland.org> writes:
On 2011-08-03 14:57:57 +0000, David Nadlinger said:

 On 8/3/11 4:07 PM, Magnus Lie Hetland wrote:
 I upgraded from OS X Snow Leopard to Lion recently (on a 32-bit iMac),
 and when I tried to run my D code afterward, I suddenly ran into all
 kinds of interesting problems (lots of failed assertions in my tests,
 and bus errors in my actual runs...).
This seems to be exactly same problem I reported to the NG some days ago. It is caused by ASLR being enabled for 32bit applications on Lion too, and kennytm is to be credited for tracking this down to a fixed stack bottom in the druntime code: https://github.com/D-Programming-Language/druntime/pull/43.
Yeah, I saw this after I posted here: "#d_lang Mac OS X Lion users - druntime patch http://t.co/9Ivehft"
 The fix has already been merged into master, please use that for OS X 
 development until the next DMD release.
OK, great. Thanks.
 David
-- Magnus Lie Hetland http://hetland.org
Aug 04 2011
prev sibling parent reply Magnus Lie Hetland <magnus hetland.org> writes:
On 2011-08-03 14:57:57 +0000, David Nadlinger said:

 This seems to be exactly same problem I reported to the NG some days 
 ago. It is caused by ASLR being enabled for 32bit applications on Lion 
 too, and kennytm is to be credited for tracking this down to a fixed 
 stack bottom in the druntime code: 
 https://github.com/D-Programming-Language/druntime/pull/43. The fix has 
 already been merged into master, please use that for OS X development 
 until the next DMD release.
Sorry for being a n00b here, but ... what's the intended way of using the Git version? It seems to be split into five different repos...? Do I have to assemble a full distro myself, or am I just missing something obvious? (I'm assuming the latter, really ;) -- Magnus Lie Hetland http://hetland.org
Aug 04 2011
next sibling parent reply =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <xtzgzorex gmail.com> writes:
On 04-08-2011 14:09, Magnus Lie Hetland wrote:
 On 2011-08-03 14:57:57 +0000, David Nadlinger said:

 This seems to be exactly same problem I reported to the NG some days
 ago. It is caused by ASLR being enabled for 32bit applications on Lion
 too, and kennytm is to be credited for tracking this down to a fixed
 stack bottom in the druntime code:
 https://github.com/D-Programming-Language/druntime/pull/43. The fix
 has already been merged into master, please use that for OS X
 development until the next DMD release.
Sorry for being a n00b here, but ... what's the intended way of using the Git version? It seems to be split into five different repos...? Do I have to assemble a full distro myself, or am I just missing something obvious? (I'm assuming the latter, really ;)
Hi, You can see my blog for Linux: http://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/ - Alex
Aug 04 2011
next sibling parent Magnus Lie Hetland <magnus hetland.org> writes:
On 2011-08-04 12:27:54 +0000, Alex Rønne Petersen said:

 Hi,
 
 You can see my blog for Linux: 
 http://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/
Thanks! --
 
Magnus Lie Hetland http://hetland.org
Aug 04 2011
prev sibling parent reply Magnus Lie Hetland <magnus hetland.org> writes:
On 2011-08-04 12:27:54 +0000, Alex Rønne Petersen said:

 Hi,
 
 You can see my blog for Linux: 
 http://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/
For
 
others trying to do the same (i.e., compile this stuff in OS X Lion), one change is needed in posix.mak: Change ... SDK=/Developer/SDKs/MacOSX10.5.sdk #SDK=/Developer/SDKs/MacOSX10.6.sdk ... into ... SDK=/Developer/SDKs/MacOSX10.5.sdk #SDK=/Developer/SDKs/MacOSX10.6.sdk SDK=/Developer/SDKs/MacOSX10.7.sdk (or equivalent). -- Magnus Lie Hetland http://hetland.org
Aug 04 2011
parent =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <xtzgzorex gmail.com> writes:
On 04-08-2011 15:21, Magnus Lie Hetland wrote:
 On 2011-08-04 12:27:54 +0000, Alex Rønne Petersen said:

 Hi,

 You can see my blog for Linux:
 http://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/
For

 others trying to do the same (i.e., compile this stuff in OS X Lion),
 one change is needed in posix.mak:

 Change ...

 SDK=/Developer/SDKs/MacOSX10.5.sdk
 #SDK=/Developer/SDKs/MacOSX10.6.sdk

 ... into ...

 SDK=/Developer/SDKs/MacOSX10.5.sdk
 #SDK=/Developer/SDKs/MacOSX10.6.sdk
 SDK=/Developer/SDKs/MacOSX10.7.sdk

 (or equivalent).
You can probably just pass SDK=... to the make process too. - Alex
Aug 04 2011
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2011-08-04 14:09, Magnus Lie Hetland wrote:
 On 2011-08-03 14:57:57 +0000, David Nadlinger said:

 This seems to be exactly same problem I reported to the NG some days
 ago. It is caused by ASLR being enabled for 32bit applications on Lion
 too, and kennytm is to be credited for tracking this down to a fixed
 stack bottom in the druntime code:
 https://github.com/D-Programming-Language/druntime/pull/43. The fix
 has already been merged into master, please use that for OS X
 development until the next DMD release.
Sorry for being a n00b here, but ... what's the intended way of using the Git version? It seems to be split into five different repos...? Do I have to assemble a full distro myself, or am I just missing something obvious? (I'm assuming the latter, really ;)
Since it's just the runtime that's been changed in this case, perhaps you just can compile the runtime and replace that with what's in the release. -- /Jacob Carlborg
Aug 04 2011
parent Magnus Lie Hetland <magnus hetland.org> writes:
On 2011-08-04 13:01:19 +0000, Jacob Carlborg said:

 Since it's just the runtime that's been changed in this case, perhaps 
 you just can compile the runtime and replace that with what's in the 
 release.
I guess so. I've just starting compiling/linking stuff together -- I'll see how it goes. (It can be useful to have the most recent version; ideally, it should have fewer bugs ;) If that fails, I could try just the runtime, as you suggest. -- Magnus Lie Hetland http://hetland.org
Aug 04 2011