From b3147029a5847526b07b9d4823e3beec3c315402 Mon Sep 17 00:00:00 2001
From: Per Bothner <pbothner@apple.com>
Date: Tue, 22 Jul 2003 23:11:34 +0000
Subject: [PATCH] re PR preprocessor/11361 (ICE (segfault) in c-lex.c with
 one-liner)

	* line-map.c (add_line_map):  Handle invalid LEAVE request.
	Fixes PR preprocessor/11361.

From-SVN: r69688
---
 gcc/ChangeLog  |  5 +++++
 gcc/line-map.c | 12 +++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 21263c286940..5e84184090ab 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2003-07-22  Per Bothner  <pbothner@apple.com>
+
+	* line-map.c (add_line_map):  Handle invalid LEAVE request.
+	Fixes PR preprocessor/11361.
+
 2003-07-22  Per Bothner  <pbothner@apple.com>
 
 	* diagnostic.c.(diagnostic_report_current_module):  Update to match
diff --git a/gcc/line-map.c b/gcc/line-map.c
index f3c2369dc9cb..50c9c881036d 100644
--- a/gcc/line-map.c
+++ b/gcc/line-map.c
@@ -96,9 +96,15 @@ linemap_add (struct line_maps *set, enum lc_reason reason,
 
       if (MAIN_FILE_P (map - 1))
 	{
-	  set->depth--;
-	  set->used--;
-	  return NULL;
+	  if (to_file == NULL)
+	    {
+	      set->depth--;
+	      set->used--;
+	      return NULL;
+	    }
+	  error = true;
+          reason = LC_RENAME;
+          from = map - 1;
 	}
       else
 	{
-- 
GitLab