Bus Error 10 Mac Os X
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions what is bus error 10 you might have Meta Discuss the workings and policies of this
Bus Error Mac
site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers
Bus Error 10 C++
or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up bus error 10 in C up vote -1 down vote favorite I am a new beginer in C, I am doing tasks from USACO, this is the "gift1" task. I would like to think solutions my self, so if you just tell me why I get this bus error 10 instead of gaving me the answer of this task, that will be grateful grateful. I am using OS X System, and gcc(from Xcode) version is Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1 Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.1.0 Thread model: posix Here is my code(still not finished yet): /* LANG: C TASK: gift1 */ #include 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 Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 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 http://stackoverflow.com/questions/29480464/bus-error-10-in-c 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; http://stackoverflow.com/questions/2061445/bus-error-in-simple-mac-osx-c-program 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,97872549 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 in it works its great but it often crashes on https://forum.openframeworks.cc/t/bus-error-10-segmentation-fault-conversion-from-string-literal-to-char/13282 launch. The most common error is Bus error: 10 but I have also had Segmentation fault: 11 and debug always says "Couldn't set thread priority." https://github.com/jcjohnson/neural-style/issues/232 I think it might be something to do with the Conversion from string literal to 'char *' being deprecated. I think there are probably a bus error few examples of this in my code and that could be causing problems. For example is this wrong. It works but maybe its causing memory issues. void testApp::drawNumbers(){char dataStr[20]; // an array of charssprintf(dataStr, "%d %d %d %d %d %d %d %d", tape[7], tape[6], tape[5], tape[4], tape[3], tape[2], tape[1], tape[0]);franklinBook.drawString(dataStr, 105,335);} bus error 10 All my code seemed much more stable on OSX 10.5.8 and now I seem to have more problems. Are there some core changes I should be aware of. The AddOns I am using areofxOscofxXmlSettingsofxBeatTracking Any tips would really be appreciated. Many thanks Simon trentbrooks 2013-09-20 06:26:26 UTC #2 Hey Simon, I would guess it's the buffer size of 20. You are storing 8 ints and 7 spacer chars, if each int is 2 digits long that's 16 + 7 chars total. You could make the buffer bigger, or just use a stringstream instead... stringstream dataStr;dataStr << tape[7] << " " << tape[6] << " " << endl;franklinBook.drawString(dataStr.str(), 105,335); simonblackmore 2013-09-20 21:00:11 UTC #3 Thanks, Trent I am sure this helps. I seem to have a heap of other troubles.I hate upgrading Cheers Simon Home Categories FAQ/Guidelines Terms of Service Privacy Policy Powered by Discourse, best viewed with JavaScript enabled Sign in Pricing Blog Support Search GitHub This repository Watch 565 Star 11,023 Fork 1,572 jcjohnson/neural-style Code Issues 192 Pull requests 17 Projects 0 Wiki Pulse Graphs New issue Bus error: 10 [OS X 10.10] #232 Open carlodelpizzo opened this Issue May 27, 2016 · 18 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 3 participants carlodelpizzo commented May 27, 2016 • edited Im on a Hackintosh, if that makes a difference? th neural_style.lua -gpu 0 -print_iter 1 … Successfully loaded models/VGG_ILSVRC_19_layers.caffemodel Bus error: 10 3DTOPO commented May 27, 2016 I am able to run neural-style on Hackintosh. I just never got the CUDA stuff working. How much memory does your system have? carlodelpizzo commented May 27, 2016 16 GB RAM. I get the same bus error if i try with CUDA or not. I cant really tell, but the CUDA backend seems to be fine. I do have my home directory on a different hard disk than my OS, but i dont think that would cause bus error? 3DTOPO commented May 27, 2016 As long as you are using -gpu 0 I think the CUDA stuff shouldn't matter. I was just mentioning for completeness. 3DTOPO commented May 27, 2016 Oops - I meant -gpu -1 to not use the GPU. carlodelpizzo commented May 27, 2016 Gotcha.. any idea where i can start troubleshooting this bus error? im at a total loss 3DTOPO commented May 27, 2016 I would say first try it with -gpu -1. Does that work? If it does, it likely has something to do with CUDA which I abandoned trying to get working and switched to Ubuntu instead. Here the thread my thread on it: #91 carlodelpizzo commented May 27, 2016 No it doesnt work that way either. I have tried "th neural_style.lua -gpu 0 -print_iter 50" "th neural_style.lua -style_image -content_image " "th neural_style.lua -gpu -1 -style_image -content_image -save_iter 50" If i try with sudo, it doesnt give me bus error. but doesnt do anything else either: 3DTOPO commented May 27, 2016 That means it worked without the GPU. The fact that you had to do it as su means you probably have some permission errors. It should have written an output file. Do a command in that directory: ls -l *.png carlodelpizzo commented May 28, 2016 3DTOPO commented May 28, 2016 Hmm - or maybe not. How long does it take before returning to the command prompt? Try to add this flag: -print_iter 10 Does it print out any messages then? carlodelpizzo commented May 28, 2016 Its prett