Clang compiler generating faulty executable when overwriting over executable [closed]

15 hours ago 2
ARTICLE AD BOX

I have a very basic helloworld.cpp file that runs just fine, but the compiler is acting up.

Whenever I use clang++ to compile the program and it creates a new file, it works just fine. That is, clang++ helloworld.cpp -o program && ./program creates a file called program and prints Hello World. However, running that same command again creates the file, but running ./program again gives 47898 killed ./program (the pid varies each time). deleting program allows for it to compile successfully again, again fails on further compilations. compiling to a different name also works as expected.

clang --version returns

Apple clang version 12.0.0 (clang-1200.0.31.1) Target: arm64-apple-darwin25.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Any ideas?

Read Entire Article