Mac Os X Terminal Bus Error
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company what is bus error 10 Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs segmentation fault: 11 Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up bus error in simple Mac OSX C program up vote 1 down vote favorite I am writing a simple C program to create a twelve tone matrix. The code compiles, but I get run time error 'Bus Error'. In the debugger it says EXC_BAD_ACCESS. int main () { int j,k,l; int twelve[13][13]; void mat(int twelve[13][13]); printf("input original tone row \n"); for(j=0;j<=11;j++) { scanf("%2i",&twelve[j][0]); } mat(twelve); for(k=0;k<=11;k++) { for(l=0;l<=11;l++) { printf("%i ",twelve[l][k]); } printf("\n"); } return 0; } void mat(twelve) int twelve[13][13]; { int j,k,l; int temp; /*inversion*/ for(j=1;j<=11;j++) { twelve[0][j] = 12 - twelve[j][0]; } /*fill in columns*/ /*this sections seems to be what's crashing it */ for(k=1;k<=11;k++) { for(l=1;1<=11;l++) { temp = twelve[0][k] + twelve[l][0]; if(temp >= 12) { twelve[k][l] = temp - 12; } else { twelve[k][l] = temp; } } } } c xcode osx exc-bad-access share|improve this question edited Oct 10 '12 at 16:48 athspk 4,99872549 asked Jan 14 '10 at 0:42 Levi 613 Compile with -g or use XCode's debugger, and let us know what line of code has the crash ;v) . –Potatoswatter Jan 14 '10 at 0:46 1 this code gives me the willies. –Stephen Canon Jan 14 '10 at 0:46 Wow, I haven't seen K&R C in ages... –R Samuel Klatchko Jan 14 '10 at 1:13 add a comment| 2 Answers 2 active oldest votes up vote 11 down vote There is a typo in the inner loop condition of the mat() subroutine. This is why I don't like 'l' (el) as an index. for(l=1;1<=11;l++) you meant "l < 11" (el) not "1 < 11" (one) One is always less than eleven, so the l (el) index increases without bound, which leads to an illegal memory access when index gets too large. share|improve this answer edited Jan 14 '10 at 0:53 answered Jan 14 '10 at 0:45 Christopher Bruns 4,74912848 1 +1. i, j
enter a title. You can not post a blank message. Please type your message and try again. This discussion is locked lazyrussian Level 1 (0 points) Q: Terminal Error (SSH leads to Bus Error) Heya,Everytime I try to ssh on my client I get a Bus Error. When I Su, and try again, it asks me for RSA authenticatin. I say yes, and then it hangs trying to connect - I assume it's tryign to connect.The I get frustrated, I close the terminal, and I try again in su mode. It just hangs at that point.Anyone know how to fix this? Macbook (Intel Core Duo, Gen 1), Mac OS X (10.5.3) Posted on Jun 6, 2008 7:41 AM I http://stackoverflow.com/questions/2061445/bus-error-in-simple-mac-osx-c-program have this question too by glsmith,Solvedanswer glsmith Level 3 (875 points) A: Glad to help (you might want to mark this as Solved so that others know there's a solution) Posted on Jun 6, 2008 12:12 PM See the answer in context Close Q: Terminal Error (SSH leads to Bus Error) All replies Helpful answers by glsmith, glsmith Jun 6, 2008 10:07 AM in response to lazyrussian Level 3 (875 points) Jun 6, 2008 10:07 AM in https://discussions.apple.com/thread/1548796?tstart=0 response to lazyrussian That error would lead me to think there's a bug in your ssh client. Is this the stock ssh client that comes with OS X, or have you installed a different one via something like Fink or MacPorts? You could run some debugging from ssh to see where things are hanging up. From your client, you could use the -v option which will give your some debugging information and may tell you who is hanging up. If that doesn't tell you anything, you can do some similar things on the remote side to the sshd daemon that is accepting your connection.However, I'm still concerned about the bus error. Can you paste your connection attempt here, showing that error? Helpful (0) Reply options Link to this post by lazyrussian, lazyrussian Jun 6, 2008 10:28 AM in response to glsmith Level 1 (0 points) Jun 6, 2008 10:28 AM in response to glsmith Heya,thanks for the reply. I'm using the Terminal.app client.Here's the output of my connection attempt:swire-d169:~ Arthur$ ssh -v jlab.orgBus errorswire-d169:~ Arthur$ suPassword:sh-3.2# ssh -v jlab.orgOpenSSH_4.7p1, OpenSSL 0.9.7l 28 Sep 2006debug1: Reading configuration data /etc/ssh_configdebug1: Connecting to jlab.org [129.57.48.43] port 22.debug1: Connection established.debug1: permanentlysetuid: 0/0debug1: identity file /var/root/.ssh/identity type -1debug1: identity file /var/root/.ssh/id_rsa type -1debug1: identity file /var/root/.ssh/id_dsa type 2debug1: Remote protocol version 2.0, remote software version OpenSSH_3.7.1p2debug1: match: OpenSSH_3.7.1p2 pat OpenSSH_3.*debug1: Enabling compatib
Intelligence Target Identification Understanding Terrain On-Demand GEOINT Professional Services Environmental Monitoring Manage Natural Resources Oil & Gas Forecast & Prepare for Natural Disasters Climate & Weather Academic Instructors Researchers Students Academic Programs Learn Videos http://www.harrisgeospatial.com/Support/HelpArticlesDetail/TabId/219/ArtMID/900/ArticleID/4053/4053.aspx Blogs Events & Webinars Tradeshows Webinars Training Course Calendar Case Studies Whitepapers Resources Tutorials Newsletters Product Brochures Books Related Sites Interactive Image Analysis Support Forums Help Articles Extensions Library Documentation Center Updates & https://en.wikipedia.org/wiki/Bus_error Maintenance Request Technical Support Company Mission, Vision & Values Contact Us About Harris Corporation Careers Benefits Press Room Newsletter Archive Blogs Legal ACCOUNT LOGIN | BUY | CONTACT Loading EN JP UK bus error IT Menu Support BUS Error When Running or Starting IDL 6.3 on Mac OSX Tuesday, May 23, 2006 Topic: In IDL 6.3, when a user or program makes its first graphics or widget call and the DISPLAY environment variable is not set, IDL 6.3 can crash reporting the Bus Error message. The following errors are actual screen mac os x shots from a Terminal window on two different Mac systems: Example: 1 (user is able to launch idl but receives the error as soon as the plot command is used.) IDL> plot,indgen(10) Bus error Example: 2 (user is unable to launch IDL.) % idl IDL Version 6.3, Mac OS X (darwin ppc m32). (c) 2006, Research Systems, Inc. Installation number: xxxxxx. Licensed for personal use by XXXXX only. All other use is strictly prohibited. Bus error This problem is most common on IDL for Mac OS X, when IDL has been launched from Mac's (not X11's) native Terminal application. (Note that calling idlde in this DISPLAY-less scenario fails in the middle of IDL initialization with no error displayed.) This problem might also occur on other UNIX / X platforms, but would be unusual since the DISPLAY variable is almost always properly set in those environments. The workaround for this is quite straightforward: Simply make sure that a DISPLAY variable is properly defined in your terminal's environment. The Discussion below gives details on how to do this.Discussion: This behavior is new to IDL starting with version 6.3. Before that Mac users could succe