|
|
|
|
13.4 Runtime error messages
error while loading shared libraries:
-
cannot open shared object file: No such file or directory
-
The program uses shared libraries, but the necessary shared library
files cannot be found by the dynamic linker when the program starts.
The search path for shared libraries is controlled by the environment
variable
LD_LIBRARY_PATH (see section 3.2 Shared libraries and static libraries).
Segmentation fault
-
Bus error
-
These runtime messages indicate a memory access error.
Common causes include:
- dereferencing a null pointer or uninitialized pointer
- out-of-bounds array access
- incorrect use of
malloc , free and related functions
- use of
scanf with invalid arguments
There is a subtle difference between segmentation faults and bus errors.
A segmentation fault occurs when a process tries to access memory
protected by the operating system. A bus error occurs when valid memory
is accessed in an incorrect way (for example, trying to read an
unaligned value on architectures where values must be aligned with
4-byte offsets).
floating point exception
-
This runtime error is caused by an arithmetic exception, such as
division by zero, overflow, underflow or an invalid operation (e.g.
taking the square root of -1). The operating system determines
which conditions produce this error. On GNU systems, the functions
feenableexcept and fedisableexcept can be used to trap or
mask each type of exception.
Illegal instruction
-
This error is produced by the operating system when an illegal machine
instruction is encountered. It occurs when code has been compiled for
one specific architecture and run on another.
|
|
|