Commit 456b8ce5 by Uros Bizjak

re PR c/24101 (Segfault with preprocessed source)

libcpp/

	PR c/24101
	* init.c (read_original_filename): Temporarily set
	state.in_directive before calling _cpp_lex_direct for
	CPP_HASH tokens.

gcc/

	PR c/24101
	* toplev.c (process_options): Initialize debug_hooks early
	in case lang_hooks.post_options ends up calling a debug_hook.

gcc/testsuite/

	PR c/24101
	* gcc.dg/pr24101-1.i, gcc.dg/pr24101-2.i: New tests.
	* gcc.dg/dg.exp: Run main loop also for *.i files.

From-SVN: r106677
parent 85e77c21
2005-11-09 Per Bothner <per@bothner.com>
Uros Bizjak <uros@kss-loka.si>
PR c/24101
* toplev.c (process_options): Initialize debug_hooks early
in case lang_hooks.post_options ends up calling a debug_hook.
2005-11-08 Jakub Jelinek <jakub@redhat.com> 2005-11-08 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (multiple_reg_loc_descriptor): Don't assume * dwarf2out.c (multiple_reg_loc_descriptor): Don't assume
......
2005-11-09 Uros Bizjak <uros@kss-loka.si>
PR c/24101
* gcc.dg/pr24101-1.i, gcc.dg/pr24101-2.i: New tests.
* gcc.dg/dg.exp: Run main loop also for *.i files.
2005-11-08 Jakub Jelinek <jakub@redhat.com> 2005-11-08 Jakub Jelinek <jakub@redhat.com>
PR c++/19450 PR c++/19450
...@@ -29,7 +29,7 @@ if ![info exists DEFAULT_CFLAGS] then { ...@@ -29,7 +29,7 @@ if ![info exists DEFAULT_CFLAGS] then {
dg-init dg-init
# Main loop. # Main loop.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cSi\]]] \
"" $DEFAULT_CFLAGS "" $DEFAULT_CFLAGS
# All done. # All done.
......
/* { dg-do compile } */
/* { dg-options "-ansi" } */
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.0/include/stddef.h" 1 3 4
/* { dg-do compile } */
/* { dg-options "-ansi" } */
#
...@@ -1493,6 +1493,10 @@ general_init (const char *argv0) ...@@ -1493,6 +1493,10 @@ general_init (const char *argv0)
static void static void
process_options (void) process_options (void)
{ {
/* Just in case lang_hooks.post_options ends up calling a debug_hook.
This can happen with incorrect pre-processed input. */
debug_hooks = &do_nothing_debug_hooks;
/* Allow the front end to perform consistency checks and do further /* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also initialization based on the command line options. This hook also
sets the original filename if appropriate (e.g. foo.i -> foo.c) sets the original filename if appropriate (e.g. foo.i -> foo.c)
...@@ -1652,7 +1656,6 @@ process_options (void) ...@@ -1652,7 +1656,6 @@ process_options (void)
default_debug_hooks = &vmsdbg_debug_hooks; default_debug_hooks = &vmsdbg_debug_hooks;
#endif #endif
debug_hooks = &do_nothing_debug_hooks;
if (write_symbols == NO_DEBUG) if (write_symbols == NO_DEBUG)
; ;
#if defined(DBX_DEBUGGING_INFO) #if defined(DBX_DEBUGGING_INFO)
......
2005-11-09 Per Bothner <per@bothner.com>
Uros Bizjak <uros@kss-loka.si>
PR c/24101
* init.c (read_original_filename): Temporarily set
state.in_directive before calling _cpp_lex_direct for
CPP_HASH tokens.
2005-11-03 James E Wilson <wilson@specifix.com> 2005-11-03 James E Wilson <wilson@specifix.com>
PR preprocessor/24202 PR preprocessor/24202
......
...@@ -497,8 +497,10 @@ read_original_filename (cpp_reader *pfile) ...@@ -497,8 +497,10 @@ read_original_filename (cpp_reader *pfile)
token = _cpp_lex_direct (pfile); token = _cpp_lex_direct (pfile);
if (token->type == CPP_HASH) if (token->type == CPP_HASH)
{ {
pfile->state.in_directive = 1;
token1 = _cpp_lex_direct (pfile); token1 = _cpp_lex_direct (pfile);
_cpp_backup_tokens (pfile, 1); _cpp_backup_tokens (pfile, 1);
pfile->state.in_directive = 0;
/* If it's a #line directive, handle it. */ /* If it's a #line directive, handle it. */
if (token1->type == CPP_NUMBER) if (token1->type == CPP_NUMBER)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment