• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EXC_BAD_ACCESS error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EXC_BAD_ACCESS error


  • Subject: Re: EXC_BAD_ACCESS error
  • From: Paul Russell <email@hidden>
  • Date: Thu, 14 Oct 2010 07:53:05 +0100

On 11 Oct 2010, at 14:49, McLaughlin, Michael P. wrote:

> Using Xcode 3.2.4 under Mac OS 10.6.4 on a 64-bit Mac Pro, I am getting a
> runtime error of
>
> EXC_BAD_ACCESS
>
> The project is a C++/CoreServices tool.  The error seems to arise because
> some legacy (Mersenne Twister) code is trying to dereference a pointer with
> a negative index.
>
> for (j = M;--j;p++)
>   *p = p[M-N] ^ TWIST(p[0], p[1]);     // M = 397, N = 624
>

One problem I've seen before with gcc on 64-bit (LP64) architectures is that address arithmetic can be erroneous when you have a signed (32-bit) int index and a (64-bit) pointer and the int is negative (because the int is not sign extended to 64 bits as it probably should be). One thing to try is to force the array index to be 64-bit, e.g. in your example:

   *p = p[(ptrdiff_t)(M-N)] ^ TWIST(p[0], p[1]);

Paul

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: EXC_BAD_ACCESS error
      • From: Andreas Grosam <email@hidden>
References: 
 >EXC_BAD_ACCESS error (From: "McLaughlin, Michael P." <email@hidden>)

  • Prev by Date: Re: Copy Preferences to another system
  • Next by Date: Re: EXC_BAD_ACCESS error
  • Previous by thread: Re: EXC_BAD_ACCESS error
  • Next by thread: Re: EXC_BAD_ACCESS error
  • Index(es):
    • Date
    • Thread