added wall/pedantic to gcc options
fixed undefined behaviour warnings