This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Seg fault in fix-header; 20000320; Solaris


On Wed, Mar 29, 2000 at 07:13:07PM -0700, Jeffrey A Law wrote:
> 
>   In message <200003212055.MAA20908@mushroom.jpl.nasa.gov>you write:
>   > 
>   > cppinit.c does not check for NULL pointer, causing fix-header to crash.
...
> There's no explanation for why opts->in_fname was null to begin with --
> without that critical piece of information, it's much more difficult to
> tell if your patch is correct or if it's just papering over a problem
> elsewhere.

opts->in_fname is null at this point because
initialize_dependency_output is being called too early; that's the
real bug.  The code that converts a null in_fname to an empty string
is in cpp_start_read, right after i_d_o; it should be right before.

I'll commit this patch after a bootstrap completes, and I will run
fix-header this time.

===================================================================
Index: cppinit.c
--- cppinit.c	2000/03/28 21:45:02	1.66
+++ cppinit.c	2000/03/30 06:49:04
@@ -896,10 +896,8 @@ cpp_start_read (pfile, fname)
       fprintf (stderr, _("End of search list.\n"));
     }
 
-  initialize_dependency_output (pfile);
-  
-  /* Open the main input file.  This must be done before -D processing
-     so we have a buffer to stand on.  */
+  /* Open the main input file.  This must be done early, so we have a
+     buffer to stand on.  */
   if (opts->in_fname == NULL || *opts->in_fname == 0)
     {
       opts->in_fname = fname;
@@ -910,6 +908,8 @@ cpp_start_read (pfile, fname)
   if (!cpp_read_file (pfile, fname))
     return 0;
 
+  initialize_dependency_output (pfile);
+  
   /* -D and friends may produce output, which should be identified
      as line 0.  */
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]