[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] bus error vs. segmentation fault
- Subject: [ale] bus error vs. segmentation fault
- From: mic at mathcs.emory.edu (Michelangelo Grigni)
- Date: Mon, 30 Oct 2000 16:26:15 -0500 (EST)
As I understand it, a "bus error" occurs when a processor
attempts to use a memory address that is misaligned for the
current instruction. For example, on a sparc an int be
stored on a word (4-byte) boundary, so something like this
would fail (unless c happens to be word-aligned):
char c;
scanf("%d", &c);
A "segmentation fault" occurs instead when you attempt to
use a memory address disallowed by the VM subsystem. For
example, trying to read an address in a non-existent page,
or modify an unwritable page, or execute in a
non-executable page. The usual example:
int *p;
*p = 1;
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.