[PATCH] Do not abort compilation when dump file is /dev/*

Alexandre Oliva oliva@gnu.org
Fri Nov 19 09:22:52 GMT 2021

On Nov 18, 2021, Richard Biener <rguenther@suse.de> wrote:

> IMHO a more reasonable thing to do would be to not treat
> -o /dev/null as a source for -dumpdir and friends.  Alex?


I think we already have some special-casing for /dev/null somewhere.

> You did the last re-org, where'd we put such special casing?

I think we're missing something like this, to avoid messing with dumpdir
with -o /dev/null.  We already use the same function when computing
outbase just below this.

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 506c2acc282d6..a986728fb91d6 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -5098,7 +5098,8 @@ process_command (unsigned int decoded_options_count,
   bool explicit_dumpdir = dumpdir;
-  if (!save_temps_overrides_dumpdir && explicit_dumpdir)
+  if ((!save_temps_overrides_dumpdir && explicit_dumpdir)
+      || (output_file != NULL && not_actual_file_p (output_file)))
       /* Do nothing.  */

Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

More information about the Gcc-patches mailing list