Add tests with optimization and gcc