There are some long-standing bugs with uninitialized access to top-level variables in script mode (what you get if you run swiftc with a single file that has top-level code in it, or if your module has a main.swift). It should be fixed certainly, but you'll find that library globals, local variables, and stored properties of types don't have this problem.