http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57784
Bug ID: 57784 Summary: GCC inadvertedly truncates source text Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: mtodorov3_69 at yahoo dot com The example goes as follows: The line: # gcc -o mypatch mypatch.cc -lstdc++ is mistyped as: # gcc -o mypatch.cc -lstdc++ GCC complains about no main() and truncates the C++ source to zero length! Correct would be to complain about wrong number of arguments before doing any action on mypatch.cc. Would it hurt to check suffix of the file referenced by "-o" option, if it is common that object file is overwritten? Few executables' names end with ".cc" or ".c". Fortunatelly, the source was recovered with minimal loss of changes from backup location :-) Greetz, mt