C program abort() make the .exe access denied after termination
18:36 03 Oct 2020

Doing different basics in C, I found an error for which no answer was found so far on the web.

Using TCC on Windows 10 in cmd prompt:

#include 
#include 
#include 

int main(int argc, char **argv) {
    abort(); //or assert()
    return 0;
}

The problem first occurred with some dummy expression in assert() (like assert(1==0); ), which calls abort(). The rest of the code, before the abort(), is only a list of printfs with several sizeof, and nothing went wrong before I added the assert/abort. The program terminates where it should. Then, I can't write (recompile) or delete the .exe. Looking in the tasklist, the program is listed as many times as it has been run. It seems stuck «somewhere». %ERRORLEVEL% gives 3. I have to taskkill them with administrator privilege.

(I tried the code on Ubuntu with gcc and it went well.)

c windows assert abort tcc