[Bug driver/36312] should refuse to overwrite input file with output file

riccardo at cs dot wisc.edu gcc-bugzilla@gcc.gnu.org
Fri Oct 14 03:53:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36312

Riccardo Mutschlechner <riccardo at cs dot wisc.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |riccardo at cs dot wisc.edu

--- Comment #21 from Riccardo Mutschlechner <riccardo at cs dot wisc.edu> ---
Not sure if this is the best place to start, but here goes. I've noticed
another similar issue.

Let's say you've compiled a binary, `test`, from a source `test.c`. If you then
flip the arguments to gcc by mistake, `gcc -o test.c test` rather than `gcc -o
test test.c`, you will overwrite the source file by trying to compile the
binary, thus losing it permanently without some other backup.

Can I add some functionality that double checks against compiling *into* a
source file extension? 

Is this cruft, or something that would actually be used - and if so, what is a
good way to go about doing this? 

Would love to do it ASAP.


More information about the Gcc-bugs mailing list