Segmentation fault, core dumped

This is a discussion on Segmentation fault, core dumped within the C Programming forums, part of the General Programming Boards category; I'm compiling with gcc and with -O2 optimisation.
Here's the code:
Code:
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/io.h>
...