GCC 4.1.1, MinGW, Windows 2000 host, X86 Linux target I'm not sure about the intended behavior, but if I compile with -Werror (a C++ source in my case) and I trigger a warning that is treated as an error, then g++ exits with a zero return status. However, an existing object file for that source is not updated with the changes in the source file. If g++ is invoked from a makefile, this means the makefile target (e.g. the object file) does not fail, meaning the linker will be invoked later on, meaning it will link successfully using the unchanged object file. This means there is a mismatch between the source and binary, causing confusion for the programmer if this person did not notice the warning.
If I introduce a real compilation error, g++ returns with a non zero return status, meaning the make will not invoke the linker (even though an old object file exists). Should gcc exit with a non zero exit status if it treats warnings as errors and the source compiles with warnings? -- Summary: -Werror does not trigger non zero exit code Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: awa at oce dot nl http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34039