Thread overview
[phobos] "bus error" happens on Mac OS X
Nov 12, 2010
Masahiro Nakagawa
Nov 12, 2010
Jacob Carlborg
Nov 12, 2010
Masahiro Nakagawa
Nov 12, 2010
Masahiro Nakagawa
Nov 12, 2010
Sean Kelly
Nov 12, 2010
Sean Kelly
November 12, 2010
Any programs raised "bus error" in the trunk (My environment is Mac OS X
10.6.4).
I checked druntime and found problematic revision.
r413 works fine but r414 and later don't (Phobos unittest stopped at crc32
test).

http://dsource.org/projects/druntime/changeset/414

The cause is an access to _moduleinfo_array.
In the above link, "m.index = i;" at line 2045 is because of this bug.
But, but, but, r414 doesn't change the creation routine of
_moduleinfo_array.

It's a mystery to me... Why?


Masahiro
November 12, 2010
You might want to have a look at the thread "Showstopper bug: Hello world fails on OSX!" and this post: http://news.gmane.org/gmane.comp.lang.d.phobos. I have a patch in the linked post, with that patch I don't get a bus error on Mac OS X 10.6.4 (at least not with a simple hello world), but I do get a bus error on 10.5.8 probably due to other reason.

On 12 nov 2010, at 06:03, Masahiro Nakagawa wrote:

> Any programs raised "bus error" in the trunk (My environment is Mac OS X 10.6.4).
> I checked druntime and found problematic revision.
> r413 works fine but r414 and later don't (Phobos unittest stopped at crc32 test).
> 
> http://dsource.org/projects/druntime/changeset/414
> 
> The cause is an access to _moduleinfo_array.
> In the above link, "m.index = i;" at line 2045 is because of this bug.
> But, but, but, r414 doesn't change the creation routine of _moduleinfo_array.
> 
> It's a mystery to me... Why?
> 
> 
> Masahiro
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos

-- 
/Jacob Carlborg

November 12, 2010
I think the Mac OS code generation has some issues.

In the original code before I checked that in, every module index is set (see
the revision before 414:
http://dsource.org/projects/druntime/browser/trunk/src/object_.d?rev=405#L1900).
 I don't see why r414 fails and r413 doesn't.

BTW, I just noticed, a lot of the code in prior versions checks to see if the array contains null pointers, does this happen?  I don't think I put those guards in.

Masahiro, can you run an assert loop like so?  I don't have a Mac, and everything appears to work fine on Linux.

foreach(m; _moduleinfo_array)
   if(!m)
      assert(0, "found null reference");

-Steve



----- Original Message ----
> From: Masahiro Nakagawa <repeatedly at gmail.com>
> To: Phobos mailing list <phobos at puremagic.com>
> Sent: Fri, November 12, 2010 12:03:01 AM
> Subject: [phobos] "bus error" happens on Mac OS X
> 
> Any programs raised "bus error" in the trunk (My environment is Mac OS X
>10.6.4).
> I checked druntime and found problematic revision.
> r413 works  fine but r414 and later don't (Phobos unittest stopped at crc32
>test).
> 
> http://dsource.org/projects/druntime/changeset/414
> 
> The cause is an  access to _moduleinfo_array.
> In the above link, "m.index = i;" at line 2045  is because of this bug.
> But, but, but, r414 doesn't change the creation  routine of _moduleinfo_array.
> 
> It's a mystery to me...  Why?
> 
> 
> Masahiro
> _______________________________________________
> phobos  mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
> 



November 13, 2010
I applied your patch.
My programs work fine, Thanks Jacob!

I follow this thread but The environment is different.
So, I thought the cause is other reason.


Masahiro

On Fri, 12 Nov 2010 17:48:33 +0900, Jacob Carlborg <doob at me.com> wrote:

> You might want to have a look at the thread "Showstopper bug: Hello world fails on OSX!" and this post: http://news.gmane.org/gmane.comp.lang.d.phobos. I have a patch in the linked post, with that patch I don't get a bus error on Mac OS X 10.6.4 (at least not with a simple hello world), but I do get a bus error on 10.5.8 probably due to other reason.
>
> On 12 nov 2010, at 06:03, Masahiro Nakagawa wrote:
>
>> Any programs raised "bus error" in the trunk (My environment is Mac OS
>> X 10.6.4).
>> I checked druntime and found problematic revision.
>> r413 works fine but r414 and later don't (Phobos unittest stopped at
>> crc32 test).
>>
>> http://dsource.org/projects/druntime/changeset/414
>>
>> The cause is an access to _moduleinfo_array.
>> In the above link, "m.index = i;" at line 2045 is because of this bug.
>> But, but, but, r414 doesn't change the creation routine of
>> _moduleinfo_array.
>>
>> It's a mystery to me... Why?
>>
>>
>> Masahiro
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
November 13, 2010
I inserted your code and assert failed.
And then, I enabled following code.

foreach (m; _moduleinfo_array)
{
      printf("\t%p\n", m);
}

Result:

Testing generated/osx/debug/unittest/crc32
         0x0
         0x146a0
         0x14ac0
         0x14ad0
         0x15dbc
         0x15df4
         0x15e2c
         0x15ea0
         0x15ecc
         0x15f68
         0x15f9c
         0x1649c
         0x1696c
         0x17ac4
         0x17fa4
         0x18308
         0x18334
         0x1836c
         0x183f8
         0x18444
         0x18524
         0x18c74
         0x18c84
         0x18cf8
         0x18d68
         0x18d9c
         0x18dcc
         0x18e0c
         0x18f60
         0x19088
         0x193ec
make[1]: *** [generated/osx/debug/unittest/crc32] Bus error
make[1]: *** Deleting file `generated/osx/debug/unittest/crc32'
make: *** [unittest] Error 2

The first element of _moduleinfo_array is null...

Currently, Jacob's patch fixes this bug :)


Masahiro

On Fri, 12 Nov 2010 21:20:06 +0900, Steve Schveighoffer <schveiguy at yahoo.com> wrote:

> I think the Mac OS code generation has some issues.
>
> In the original code before I checked that in, every module index is set
> (see
> the revision before 414:
> http://dsource.org/projects/druntime/browser/trunk/src/object_.d?rev=405#L1900).
>  I don't see why r414 fails and r413 doesn't.
>
> BTW, I just noticed, a lot of the code in prior versions checks to see
> if the
> array contains null pointers, does this happen?  I don't think I put
> those
> guards in.
>
> Masahiro, can you run an assert loop like so?  I don't have a Mac, and everything appears to work fine on Linux.
>
> foreach(m; _moduleinfo_array)
>    if(!m)
>       assert(0, "found null reference");
>
> -Steve
>
>
>
> ----- Original Message ----
>> From: Masahiro Nakagawa <repeatedly at gmail.com>
>> To: Phobos mailing list <phobos at puremagic.com>
>> Sent: Fri, November 12, 2010 12:03:01 AM
>> Subject: [phobos] "bus error" happens on Mac OS X
>>
>> Any programs raised "bus error" in the trunk (My environment is Mac OS X
>> 10.6.4).
>> I checked druntime and found problematic revision.
>> r413 works  fine but r414 and later don't (Phobos unittest stopped at
>> crc32
>> test).
>>
>> http://dsource.org/projects/druntime/changeset/414
>>
>> The cause is an  access to _moduleinfo_array.
>> In the above link, "m.index = i;" at line 2045  is because of this bug.
>> But, but, but, r414 doesn't change the creation  routine of
>> _moduleinfo_array.
>>
>> It's a mystery to me...  Why?
>>
>>
>> Masahiro
>> _______________________________________________
>> phobos  mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>>
>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
November 12, 2010
On Nov 12, 2010, at 4:20 AM, Steve Schveighoffer wrote:

> I think the Mac OS code generation has some issues.
> 
> In the original code before I checked that in, every module index is set (see the revision before 414: http://dsource.org/projects/druntime/browser/trunk/src/object_.d?rev=405#L1900). I don't see why r414 fails and r413 doesn't.
> 
> BTW, I just noticed, a lot of the code in prior versions checks to see if the array contains null pointers, does this happen?  I don't think I put those guards in.

It does happen, though I don't know why.  The module dependency tree has been screwed up for me on OSX in the past, so it wouldn't surprise me if there were an issue with OSX codegen here.  I just haven't taken the time to try and find it.
November 12, 2010
Hm... I guess I need Walter to say whether it's a valid condition for a module to be null in the moduleinfo array.  Is that true Walter?  If so, I'll put the guards back in.

If not, should druntime look for that condition and throw an error?

-Steve



----- Original Message ----
> From: Masahiro Nakagawa <repeatedly at gmail.com>
> To: Discuss the phobos library for D <phobos at puremagic.com>
> Sent: Fri, November 12, 2010 1:30:50 PM
> Subject: Re: [phobos] "bus error" happens on Mac OS X
> 
> I inserted your code and assert failed.
> And then, I enabled following  code.
> 
> foreach (m; _moduleinfo_array)
> {
>       printf("\t%p\n", m);
> }
> 
> Result:
> 
> Testing  generated/osx/debug/unittest/crc32
>         0x0
>          0x146a0
>         0x14ac0
>          0x14ad0
>         0x15dbc
>          0x15df4
>         0x15e2c
>          0x15ea0
>         0x15ecc
>          0x15f68
>         0x15f9c
>          0x1649c
>         0x1696c
>          0x17ac4
>         0x17fa4
>          0x18308
>         0x18334
>          0x1836c
>         0x183f8
>          0x18444
>         0x18524
>          0x18c74
>         0x18c84
>          0x18cf8
>         0x18d68
>          0x18d9c
>         0x18dcc
>          0x18e0c
>         0x18f60
>          0x19088
>         0x193ec
> make[1]:  *** [generated/osx/debug/unittest/crc32] Bus error
> make[1]: *** Deleting file  `generated/osx/debug/unittest/crc32'
> make: *** [unittest] Error 2
> 
> The  first element of _moduleinfo_array is null...
> 
> Currently, Jacob's patch  fixes this bug :)
> 
> 
> Masahiro
> 
> On Fri, 12 Nov 2010 21:20:06 +0900,  Steve Schveighoffer <schveiguy at yahoo.com>
>wrote:
> 
> >  I think the Mac OS code generation has some issues.
> > 
> > In the  original code before I checked that in, every module index is set
>(see
> >  the revision before 414:
> > 
>http://dsource.org/projects/druntime/browser/trunk/src/object_.d?rev=405#L1900).
> >   I don't see why r414 fails and r413 doesn't.
> > 
> > BTW, I just  noticed, a lot of the code in prior versions checks to see if
>the
> > array  contains null pointers, does this happen?  I don't think I put  those guards in.
> > 
> > Masahiro, can you run an assert loop  like so?  I don't have a Mac, and everything appears to work fine  on Linux.
> > 
> > foreach(m; _moduleinfo_array)
> >     if(!m)
> >       assert(0, "found null reference");
> > 
> > -Steve
> > 
> > 
> > 
> > ----- Original Message  ----
> >> From: Masahiro Nakagawa <repeatedly at gmail.com>
> >> To:  Phobos mailing list <phobos at puremagic.com>
> >>  Sent: Fri, November 12, 2010 12:03:01 AM
> >> Subject: [phobos] "bus  error" happens on Mac OS X
> >> 
> >> Any programs raised "bus  error" in the trunk (My environment is Mac OS X
> >> 10.6.4).
> >>  I checked druntime and found problematic revision.
> >> r413 works   fine but r414 and later don't (Phobos unittest stopped at
crc32
> >>  test).
> >> 
> >> http://dsource.org/projects/druntime/changeset/414
> >> 
> >>  The cause is an  access to _moduleinfo_array.
> >> In the above  link, "m.index = i;" at line 2045  is because of this bug.
> >> But,  but, but, r414 doesn't change the creation  routine of
>_moduleinfo_array.
> >> 
> >> It's a mystery to me...   Why?
> >> 
> >> 
> >> Masahiro
> >>  _______________________________________________
> >> phobos  mailing  list
> >> phobos at puremagic.com
> >> http://lists.puremagic.com/mailman/listinfo/phobos
> >> 
> > 
> > 
> > _______________________________________________
> > phobos  mailing list
> > phobos at puremagic.com
> > http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos  mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
> 



November 12, 2010
Hm... I guess the opApply in ModuleInfo could just skip null entries.  Or assert.  Either would be better than simply passing them through to the caller.

On Nov 12, 2010, at 11:25 AM, Steve Schveighoffer wrote:

> Hm... I guess I need Walter to say whether it's a valid condition for a module to be null in the moduleinfo array.  Is that true Walter?  If so, I'll put the guards back in.
> 
> If not, should druntime look for that condition and throw an error?
> 
> -Steve
> 
> 
> 
> ----- Original Message ----
>> From: Masahiro Nakagawa <repeatedly at gmail.com>
>> To: Discuss the phobos library for D <phobos at puremagic.com>
>> Sent: Fri, November 12, 2010 1:30:50 PM
>> Subject: Re: [phobos] "bus error" happens on Mac OS X
>> 
>> I inserted your code and assert failed.
>> And then, I enabled following  code.
>> 
>> foreach (m; _moduleinfo_array)
>> {
>>      printf("\t%p\n", m);
>> }
>> 
>> Result:
>> 
>> Testing  generated/osx/debug/unittest/crc32
>>        0x0
>>         0x146a0
>>        0x14ac0
>>         0x14ad0
>>        0x15dbc
>>         0x15df4
>>        0x15e2c
>>         0x15ea0
>>        0x15ecc
>>         0x15f68
>>        0x15f9c
>>         0x1649c
>>        0x1696c
>>         0x17ac4
>>        0x17fa4
>>         0x18308
>>        0x18334
>>         0x1836c
>>        0x183f8
>>         0x18444
>>        0x18524
>>         0x18c74
>>        0x18c84
>>         0x18cf8
>>        0x18d68
>>         0x18d9c
>>        0x18dcc
>>         0x18e0c
>>        0x18f60
>>         0x19088
>>        0x193ec
>> make[1]:  *** [generated/osx/debug/unittest/crc32] Bus error
>> make[1]: *** Deleting file  `generated/osx/debug/unittest/crc32'
>> make: *** [unittest] Error 2
>> 
>> The  first element of _moduleinfo_array is null...
>> 
>> Currently, Jacob's patch  fixes this bug :)
>> 
>> 
>> Masahiro
>> 
>> On Fri, 12 Nov 2010 21:20:06 +0900,  Steve Schveighoffer <schveiguy at yahoo.com> wrote:
>> 
>>> I think the Mac OS code generation has some issues.
>>> 
>>> In the  original code before I checked that in, every module index is set
>> (see
>>> the revision before 414:
>>> 
>> http://dsource.org/projects/druntime/browser/trunk/src/object_.d?rev=405#L1900).
>>>  I don't see why r414 fails and r413 doesn't.
>>> 
>>> BTW, I just  noticed, a lot of the code in prior versions checks to see if
>> the
>>> array  contains null pointers, does this happen?  I don't think I put  those guards in.
>>> 
>>> Masahiro, can you run an assert loop  like so?  I don't have a Mac, and everything appears to work fine  on Linux.
>>> 
>>> foreach(m; _moduleinfo_array)
>>>    if(!m)
>>>      assert(0, "found null reference");
>>> 
>>> -Steve
>>> 
>>> 
>>> 
>>> ----- Original Message  ----
>>>> From: Masahiro Nakagawa <repeatedly at gmail.com>
>>>> To:  Phobos mailing list <phobos at puremagic.com>
>>>> Sent: Fri, November 12, 2010 12:03:01 AM
>>>> Subject: [phobos] "bus  error" happens on Mac OS X
>>>> 
>>>> Any programs raised "bus  error" in the trunk (My environment is Mac OS X
>>>> 10.6.4).
>>>> I checked druntime and found problematic revision.
>>>> r413 works   fine but r414 and later don't (Phobos unittest stopped at
> crc32
>>>> test).
>>>> 
>>>> http://dsource.org/projects/druntime/changeset/414
>>>> 
>>>> The cause is an  access to _moduleinfo_array.
>>>> In the above  link, "m.index = i;" at line 2045  is because of this bug.
>>>> But,  but, but, r414 doesn't change the creation  routine of
>> _moduleinfo_array.
>>>> 
>>>> It's a mystery to me...   Why?
>>>> 
>>>> 
>>>> Masahiro
>>>> _______________________________________________
>>>> phobos  mailing  list
>>>> phobos at puremagic.com
>>>> http://lists.puremagic.com/mailman/listinfo/phobos
>>>> 
>>> 
>>> 
>>> _______________________________________________
>>> phobos  mailing list
>>> phobos at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>> _______________________________________________
>> phobos  mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>> 
> 
> 
> 
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos