Questions tagged [bus-error]

142 questions
342
votes
17 answers

What is a bus error? Is it different from a segmentation fault?

What does the "bus error" message mean, and how does it differ from a segmentation fault?
raldi
  • 21,344
  • 33
  • 76
  • 86
41
votes
7 answers

Bus error vs Segmentation fault

Difference between a bus error and a segmentation fault? Can it happen that a program gives a seg fault and stops for the first time and for the second time it may give a bus error and exit ?
Thunderboltz
  • 1,597
  • 3
  • 14
  • 16
21
votes
9 answers

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…
Josh Kelley
  • 56,064
  • 19
  • 146
  • 246
17
votes
12 answers

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?
Lazer
  • 90,700
  • 113
  • 281
  • 364
12
votes
3 answers

How to fix "Bus error 10" after update to Xcode 10.2

I updated Xcode to new stable 10.2v. I tried to build my project and it was successful. When I'm trying to archive the project (workspace), I'm getting errors like on screenshot below: What I've tried so far: Update cocoa pods to latest version…
iTKerry
  • 172
  • 1
  • 9
9
votes
2 answers

How do I fix 'bus error' when trying to do git-commit or git-status

I have a git repository on an OS X server that used to work fine. I was able to add files, commit them, and pull the content to my laptop. Now, when I ssh into the server and do git commit or git status in the repository, all I see in the command…
Wilbo Baggins
  • 2,701
  • 3
  • 26
  • 39
7
votes
2 answers

Why does "empty" loop cause bus error when compiling C program with clang -O2 on macOS?

I'm on macOS High Sierra. $ uname -v Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 I have the following synthesized program. void nop1() { for (;;); } void nop2() { while (1); } void nop3()…
Karl Marklund
  • 485
  • 1
  • 4
  • 10
7
votes
2 answers

Dereferencing function pointers in C to access CODE memory

We are dealing with C here. I'm just had this idea, wondering if it is possible to access the point in memory where a function is stored, say foo and copying the contents of the function to another point in memory. Specifically, I'm trying to get…
theideasmith
  • 2,835
  • 2
  • 13
  • 20
6
votes
3 answers

Why does the following C program give a bus error?

I think it's the very first strtok call that's failing. It's been a while since I've written C and I'm at a loss. Thanks very much. #include #include int main(int argc, char **argv) { char *str = "one|two|three"; char *tok…
nc.
  • 7,179
  • 5
  • 28
  • 38
6
votes
1 answer

I am getting a bus error in the following code

I am getting bus error in my code. With this code I am trying to convert numbers to words, but I know that there is a flaw in my logic. But before that, when I compile and run this code using g++ on Mac, I am trying to make this code run as it is…
Dangerous Scholar
  • 225
  • 1
  • 3
  • 12
4
votes
3 answers

Bus error while running a simple string C program

I was running this simple program, the output i get is a "bus error". using some debugging statements i found the point at which it occurs was at the strcat() call. #include #include main() { char *s = "this is "; char *s1 = "me";…
Maverickgugu
  • 767
  • 4
  • 13
  • 26
4
votes
2 answers

Bus Error when writing to mmaped data

When I first made this project last semester, the code worked fine. Now I get a bus error when the mmapped memory to share between processes is being written to and I'm not sure why it is not working anymore. Account_Info *mapData() { int fd; …
Hamon148
  • 137
  • 1
  • 12
4
votes
1 answer

Program received signal SIGBUS: Access to an undefined portion of a memory object

I have this simple Fortran code and a function which I explicitly supply with an argument in the main program. The code is below: implicit none real*8 rrr,x external tttt x = rrr(10) end function rrr(seed) integer seed, k …
user3578925
  • 881
  • 3
  • 16
  • 26
4
votes
1 answer

OS/X 64-bit assembly code generates bus error

I am trying to learn NASM on my 64-bit Macbook Pro. I have the following code where I am trying to assign the value of a variable to an initialised variable. global start default rel section .data a: dq 1 section .bss b: resq …
soarjay
  • 641
  • 4
  • 17
3
votes
3 answers

Why does my 2D array cause a bus error in C?

I'm attempting to create a simple 2D array in C but apparently running into some memory trouble. My setup is simple enough and I can't tell what's wrong. I admit that my understanding of pointers is insufficient, but I still think this should be…
Josh Leitzel
  • 15,089
  • 13
  • 59
  • 76
1
2 3
9 10