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]

[PATCH] Fix PR 35061 (#pragma pop_macro causes ICE if no macro value on stack)


his fixes the ICE reported in PR 35061 (#pragma pop_macro causes ICE
if no macro value on stack), which is caused by failing to check that
the pushed_macro_table has been allocated.

Is this OK for 4.4 once 4.3.0 branches?
Tested on i686-pc-mingw32

:ADDPATCH preprocessor:

2008-02-05  Danny Smith  <dannysmith@users.sourceforge.net>

	PR preprocessor/35061
	* c-pragma.c (handle_pragma_pop_macro): Check that
	pushed_macro_table has been allocated.


Index: c-pragma.c
===================================================================
--- c-pragma.c	(revision 131857)
+++ c-pragma.c	(working copy)
@@ -341,7 +341,7 @@
   enum cpp_ttype token;
   struct def_pragma_macro dummy, *c;
   const char *macroname;
-  void **slot;
+  void **slot = NULL;

   if (pragma_lex (&x) != CPP_OPEN_PAREN)
     GCC_BAD ("missing %<(%> after %<#pragma pop_macro%> - ignored");
@@ -367,8 +367,9 @@

   dummy.hash = htab_hash_string (macroname);
   dummy.name = macroname;
-  slot = htab_find_slot_with_hash (pushed_macro_table, &dummy,
-				   dummy.hash, NO_INSERT);
+  if (pushed_macro_table)
+    slot = htab_find_slot_with_hash (pushed_macro_table, &dummy,
+				     dummy.hash, NO_INSERT);
   if (slot == NULL)
     return;
   c = *slot;


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