Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gcc exit status codes

Tags:

gcc

I've noticed that when running gcc, if the compile failes, most of the time it returns an exit status code of '1'. However, it sometimes returns a status code of '4' (for example, if the input file does not exist). I haven't been able to find anything in the gcc documentation that covers what different error codes might mean -- does anyone know of any?

like image 265
Chris Dodd Avatar asked Oct 21 '25 03:10

Chris Dodd


1 Answers

According to the official documentation of the command line switch -pass-exit-codes:

Normally the gcc program exits with the code of 1 if any phase of the compiler returns a non-success return code. If you specify -pass-exit-codes, the gcc program instead returns with the numerically highest error produced by any phase returning an error indication. The C, C++, and Fortran front ends return 4 if an internal compiler error is encountered.

like image 76
sirain Avatar answered Oct 25 '25 06:10

sirain