Re: Xcode 7 hanging with multi-dimensional vector resize DISREGARD
Re: Xcode 7 hanging with multi-dimensional vector resize DISREGARD
- Subject: Re: Xcode 7 hanging with multi-dimensional vector resize DISREGARD
- From: Michael McLaughlin <email@hidden>
- Date: Fri, 11 Dec 2015 14:38:35 -0500
Please ignore my last email. I was indeed off by one index.On Dec 11, 2015, at 2:11 PM, Jens Alfke < email@hidden> wrote:
On Dec 11, 2015, at 10:23 AM, Michael McLaughlin < email@hidden> wrote:
v2.resize(length); for (c = 0;c <= length;c++) v2[c].resize(length2);
You have an off-by-one bug and are writing past the end of the v2 vector. (The “<=“ should be “<“.) For random reasons depending on how the heap happens to be laid out at the moment, this will sometimes be benign and sometimes cause terrible problems.
PSA: Turning on the Address Sanitizer in Xcode 7 (it’s in the Run and Test sections of the scheme editor) would probably have caught this at the moment it occurred.
—Jens
|
_______________________________________________
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