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

Bernhard Reutner-Fischer rep.dot.nop@gmail.com
Fri Nov 19 14:47:16 GMT 2021


On Fri, 19 Nov 2021 15:12:35 +0100 (CET)
Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:

> On Fri, 19 Nov 2021, Giuliano Belinassi wrote:

> > -It defaults to the location of the output file; options
> > +It defaults to the location of the output file, unless the output
> > +file is a special file like @code{/dev/null}. Options

s/a special file like //

I'd say.
thanks,
> >  @option{-save-temps=cwd} and @option{-save-temps=obj} override this
> >  default, just like an explicit @option{-dumpdir} option.  In case
> >  multiple such options are given, the last one prevails:
> > diff --git a/gcc/gcc.c b/gcc/gcc.c
> > index 506c2acc282..43d7cde1be9 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.  */
> >      }
> > @@ -10716,7 +10717,8 @@ static bool
> >  not_actual_file_p (const char *name)
> >  {
> >    return (strcmp (name, "-") == 0
> > -	  || strcmp (name, HOST_BIT_BUCKET) == 0);
> > +	  || strcmp (name, HOST_BIT_BUCKET) == 0
> > +	  || strcmp (name, "/dev/zero") == 0);
> >  }  
> 
> OK when you omit the change to include /dev/zero in not_actual_file_p.


More information about the Gcc-patches mailing list