This is the mail archive of the gcc-patches@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]

Re: PATCH to defer cpp_read_main_file and related changes


DJ Delorie wrote:

Better, but still...

dj@greed pts/1 ~/gnu/gcc/linux/gcc
$ gdb cc1
[ gdb ] r -E -imacros dj.h dj.c
# 1 "<built-in>"
# 1 "<command line>"
# 1 "./dj.h" 1
# 2 "<command line>" 2
# 1 "dj.c"

Program received signal SIGSEGV, Segmentation fault.
0x4207a703 in strlen () from /lib/tls/libc.so.6

Fixed by the attached patch, which I've checked in. -- --Per Bothner per@bothner.com http://per.bothner.com/

2003-11-05  Per Bothner  <pbothner@apple.com>

	* c-opts.c (finish_options):  Set include_cursor to disable premature
	calls to push_command_line_include from cpp_scan_nooutput.
	Fixes bug reported by DJ Delorie.

Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.93
diff -u -p -r1.93 c-opts.c
--- c-opts.c	3 Nov 2003 07:24:28 -0000	1.93
+++ c-opts.c	5 Nov 2003 21:06:11 -0000
@@ -1440,10 +1440,20 @@ finish_options (const char *tif)
 
 	  if (opt->code == OPT_imacros
 	      && cpp_push_include (parse_in, opt->arg))
-	    cpp_scan_nooutput (parse_in);
+	    {
+	      /* Disable push_command_line_include callback for now. */
+	      include_cursor = deferred_count + 1;
+	      cpp_scan_nooutput (parse_in);
+	    }
 	}
     }
 

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