Re: [PATCH] Driver: Reject output filenames with the same suffixes as source files [PR80182]

2024-05-06 Thread Richard Biener
On Mon, May 6, 2024 at 10:29 AM Peter0x44 wrote: > > On Mon May 6, 2024 at 8:14 AM BST, Richard Biener wrote: > > On Sat, May 4, 2024 at 9:36 PM Peter Damianov wrote: > > > > > > Currently, commands like: > > > gcc -o file.c -lm > > > will delete the user's code. > > > > Since there's an error

Re: [PATCH] Driver: Reject output filenames with the same suffixes as source files [PR80182]

2024-05-06 Thread Peter0x44
On Mon May 6, 2024 at 8:14 AM BST, Richard Biener wrote: > On Sat, May 4, 2024 at 9:36 PM Peter Damianov wrote: > > > > Currently, commands like: > > gcc -o file.c -lm > > will delete the user's code. > > Since there's an error from the linker in the end (missing 'main'), I wonder > if > the

Re: [PATCH] Driver: Reject output filenames with the same suffixes as source files [PR80182]

2024-05-06 Thread Richard Biener
On Sat, May 4, 2024 at 9:36 PM Peter Damianov wrote: > > Currently, commands like: > gcc -o file.c -lm > will delete the user's code. Since there's an error from the linker in the end (missing 'main'), I wonder if the linker can avoid truncating/opening the output file instead? A trivial

[PATCH] Driver: Reject output filenames with the same suffixes as source files [PR80182]

2024-05-04 Thread Peter Damianov
Currently, commands like: gcc -o file.c -lm will delete the user's code. This patch checks the suffix of the output, and errors if the output ends in any of the suffixes listed in default_compilers. Unfortunately, I couldn't come up with a better heuristic to diagnose this case more