This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: cc1 of nonexistent file still segfaults
- From: Jim Wilson <wilson at specifixinc dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: Per Bothner <per at bothner dot com>, gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 13 Apr 2004 23:24:05 -0700
- Subject: Re: cc1 of nonexistent file still segfaults
- References: <94206658-836E-11D8-8BF3-000A95DA505C@dberlin.org>
Daniel Berlin wrote:
Daniel-Berlins-Computer:~/gcc/build/gcc dberlin$ ./cc1 -O1 nonexistent.c
cc1: nonexistent.c: No such file or directory
cc1: internal compiler error: Bus error
I noticed this was still broken, so I wrote a patch for it, and checked
it in. The solution that seems right to me is the same one that Per
suggested, namely, changing c_common_post_options to set errorcount when
the input file is missing.
I tested this patch with an x86 linux bootstrap and make check. There
were no regressions.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
2004-04-13 James E Wilson <wilson@specifixinc.com>
* c-opt.c (c_common_post_options): If this_input_filename is NULL,
increment errorcount and return false instead of true.
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.109
diff -p -r1.109 c-opts.c
*** c-opts.c 1 Apr 2004 03:50:27 -0000 1.109
--- c-opts.c 13 Apr 2004 23:31:31 -0000
*************** c_common_post_options (const char **pfil
*** 1171,1178 ****
*pfilename = this_input_filename
= cpp_read_main_file (parse_in, in_fnames[0]);
if (this_input_filename == NULL)
! return true;
if (flag_working_directory
&& flag_preprocess_only && ! flag_no_line_commands)
--- 1171,1182 ----
*pfilename = this_input_filename
= cpp_read_main_file (parse_in, in_fnames[0]);
+ /* Don't do any compilation or preprocessing if there is no input file. */
if (this_input_filename == NULL)
! {
! errorcount++;
! return false;
! }
if (flag_working_directory
&& flag_preprocess_only && ! flag_no_line_commands)