触发bus error的代码片段
char s1[10] = "string";
char s2[10];
//    s2 = "string"; // cant't assign to char array  
s2[0] = 'b';

char *s3 = "string";
char *s4;
s4 = "string"; // s4 points to a string literal, It's read only.

s3[0] = 'S'; // Occur: bus err
printf("1: %s, 2: %s, 3: %s, 4: %s \n", s1, s2, s3, s4);

原因

Quote from stackoverflow:

Bus errors are rare nowadays on x86 and occur when your processor cannot even attempt the memory access requested, typically:

What is a bus error?