aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorGiuliano Belinassi <gbelinassi@suse.de>2021-11-16 13:25:32 -0300
committerGiuliano Belinassi <gbelinassi@suse.de>2021-11-19 11:27:21 -0300
commitc7381debe4c5dd7878338f38db98face1cfa6f90 (patch)
tree470e16f5fcf854a2d4591a9552e00acb41686233 /gcc/gcc.c
parentcb09215ad0bbc96fd67aac16004d2131739df096 (diff)
downloadgcc-c7381debe4c5dd7878338f38db98face1cfa6f90.zip
gcc-c7381debe4c5dd7878338f38db98face1cfa6f90.tar.gz
gcc-c7381debe4c5dd7878338f38db98face1cfa6f90.tar.bz2
Do not abort compilation when dump file is /dev/*
The `configure` scripts generated with autoconf often tests compiler features by setting output to `/dev/null`, which then sets the dump folder as being /dev/* and the compilation halts with an error because GCC cannot create files in /dev/. This is a problem when configure is testing for compiler features because it cannot tell if the failure was due to unsupported features or any other problem, and disable it even if it is working. As an example, running configure overriding CFLAGS="-fdump-ipa-clones" will result in several compiler-features as being disabled because of gcc halting with an error creating files in /dev/*. This commit fixes this issue by checking if the output file is /dev/null or /dev/zero. In this case we use the current working directory for dump output instead of the directory of the output file because we cannot write to /dev/*. gcc/ChangeLog 2021-11-16 Giuliano Belinassi <gbelinassi@suse.de> * gcc.c (process_command): Skip dumpdir override if file is a not_actual_file_p. * doc/invoke.texi: Update -dumpdir documentation. gcc/testsuite/ChangeLog 2021-11-16 Giuliano Belinassi <gbelinassi@suse.de> * gcc.dg/devnull-dump.c: New. Signed-off-by: Giuliano Belinassi <gbelinassi@suse.de>
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 506c2ac..6ff2278 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 && not_actual_file_p (output_file)))
{
/* Do nothing. */
}