You need to elaborate a little more about your setup.
1 - Use clang. The gcc that is part of the Xcode command line tools is actually a wrapper around clang/llvm. Probably going away in the near future. Plus, that version of gcc is stopped at 4.2.1, because of the adoption of the GNU V3 license by the Free Software Foundation. Apple refuses to use GNU V3 licensed software anymore.
2 - Why does the internet have anything to do with compiling source code on your Mac? What terminal program are you using? If you are using the Terminal.app, located in /Applications/Utilities, doesn't require an Internet connection at all. If you are using Xterm with XQuartz, still shouldn't be a problem if you are using it on a local machine.
3 - Just compiled a test program for Objective-C with gcc, same setup as yours. Build an object file faster than I could time. More lines of code than hello world.
1. When I type clang hello.c, I run into the same issue of the terminal hanging.
gcc --version produces the following output:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-118.104.22.168)
Thread model: posix
2. Internet does not have anything to do with compiling the source code. I was just noting that this was a strange side effect that I do not know how to explain; when my terminal hangs, my google chrome windows say that I lost internet connection for some reason.
Also, yes I am using the Terminal.app from /Applications/Utilities
3. I'm not too sure what else to be trying at this point. I haven't found anyone/anything online with this similar issue. I've called two different Apple support people and have visited the Apple store in-person with no luck unfortunately. Thank you for trying to help though!