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]
Other format: [Raw text]

[Bug c/24101] [3.4/4.0/4.1 Regression] Segfault with preprocessed source



------- Comment #5 from bothner at gcc dot gnu dot org  2005-10-31 16:58 -------
The two test cases appear to be unrelated problems.

The inital report is because an invalid line marker is seen before debug_hooks
is set in process_options.  fe_enter doesn't normally see an LC_ENTER during
read_original_filename.
One possible fix to to initialize debug_hooks statically in toplev.c:
const struct gcc_debug_hooks *debug_hooks = &do_nothing_debug_hooks;

The other testcase is because _cpp_pop_buffer is called prematurely, because
the code doesn't know we're in a directive.
A possible fix for that is to set/clear pfile->state.in_directive areound the
second _cpp_lex_direct in read_original_filename:
  if (token->type == CPP_HASH)
    {
      pfile->state.in_directive = 1;
      token1 = _cpp_lex_direct (pfile);
      _cpp_backup_tokens (pfile, 1);
      pfile->state.in_directive = 0;

I haven't updated my cvs archive yet, but if someone coudl volunteer to test
these fixes that woudl be appreciated.


-- 

bothner at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-09-28 12:56:06         |2005-10-31 16:58:29
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24101


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