bus-error

"Bus error" accessing a set<int> from a struct

Searched for a while, but I can't figure out why this would raise a bus error. Any help would be much appreciated. typedef struct { set<int> pages; } someStruct; ... void someFunction() { ... someStruct *a = createSomeStruct(); // just mallocs and returns a->pages.insert(5); ... } ...

C Malloc to a Pointer Through Function Call Causes Bus Error

Due to my feeble understanding of allocating type memory to pointers, the following causes a bus error on the call to barrier_create ("hi" is never printed). typedef struct barrier barrier_t; typedef struct barrier *barrier_p; barrier_p test_barrier_p; int main(int argc, char *argv[]) { barrier_create(*test_barrier_p); } int barr...

C: Bus Error using different compilation arguments

So it's the third week of my life in C and I've been given the task of writing a program which takes in upto 100words which are upto 80characters long, calculates the average word length of the inputs, prints words larger than the average, and finally prints the average word size. EDIT: We also have to use an emalloc, a recursive output ...

C++ Bus error in SPARC arcitecture

I would like to understand why I am getting a bus error with this code. int main() { int p=34; int *pp= (int *) ((char *)&p+1); cout<<*pp<<"\n"; return 0; } ...

How to get a "bus error"?

I am trying very hard to get a bus error. One way is misaligned access and I have tried the examples given here and here, but no error for me - the programs execute just fine. Is there some situation which is sure to produce a bus error? ...

Debugging SIGBUS on x86 Linux

What can cause SIGBUS (bus error) on a generic x86 userland application in Linux? All of the discussion I've been able to find online is regarding memory alignment errors, which from what I understand doesn't really apply to x86. (My code is running on a Geode, in case there are any relevant processor-specific quirks there.) ...

std::cin >> *aa results in a bus error

I have this a class called PPString: PPString.h #ifndef __CPP_PPString #define __CPP_PPString #include "PPObject.h" class PPString : public PPObject { char *stringValue[]; public: char *pointerToCharString(); void setCharString(char *charString[]); void setCharString(const char charString[]); }; #endif PPString.cpp...

[BUG] Bus Error - What causes this in Ruby?

I have run into this error 5 or 10 times over the past few years and have never found a clear answer to this problem. Here is the error: $ rake db:migrate /usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.9.5/lib/libxml_ruby.bundle: [BUG] Bus Error ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.7.0] Abort trap The app I am running thi...

Scanf fails with bus error

I'm playing with C and I've run into this error: #include <stdio.h> int main () { char* foo; scanf("%s", foo); printf("entered %s", foo); return 0; } scanf takes pointer, foo is pointer, yet I get bus error. How can I make it work? ...

Bus error when using GLUT.

I am trying to create a GLUT application. Currently, I have this code: void init ( GLvoid ) // Create Some Everyday Functions { glShadeModel(GL_SMOOTH); // Enable Smooth Shading glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background glClearDepth(1.0f); ...