Commit 101e174d by Danny Smith Committed by Danny Smith

re PR preprocessor/35061 (#pragma pop_macro causes ICE if no macro value on stack)

	PR preprocessor/35061
gcc
	* c-pragma.c (handle_pragma_pop_macro): Check that
	pushed_macro_table has been allocated.
testsuite
	* gcc.dg/cpp/pragma_pop_macro-1.c:  New file

From-SVN: r132322
parent 0cc24ff0
2008-02-14 Danny Smith <dannysmith@users.sourceforge.net>
PR preprocessor/35061
* c-pragma.c (handle_pragma_pop_macro): Check that
pushed_macro_table has been allocated.
2008-02-14 Eric Botcazou <ebotcazou@adacore.com> 2008-02-14 Eric Botcazou <ebotcazou@adacore.com>
PR middle-end/35136 PR middle-end/35136
......
...@@ -341,7 +341,7 @@ handle_pragma_pop_macro (cpp_reader *reader) ...@@ -341,7 +341,7 @@ handle_pragma_pop_macro (cpp_reader *reader)
enum cpp_ttype token; enum cpp_ttype token;
struct def_pragma_macro dummy, *c; struct def_pragma_macro dummy, *c;
const char *macroname; const char *macroname;
void **slot; void **slot = NULL;
if (pragma_lex (&x) != CPP_OPEN_PAREN) if (pragma_lex (&x) != CPP_OPEN_PAREN)
GCC_BAD ("missing %<(%> after %<#pragma pop_macro%> - ignored"); GCC_BAD ("missing %<(%> after %<#pragma pop_macro%> - ignored");
...@@ -367,8 +367,9 @@ handle_pragma_pop_macro (cpp_reader *reader) ...@@ -367,8 +367,9 @@ handle_pragma_pop_macro (cpp_reader *reader)
dummy.hash = htab_hash_string (macroname); dummy.hash = htab_hash_string (macroname);
dummy.name = macroname; dummy.name = macroname;
slot = htab_find_slot_with_hash (pushed_macro_table, &dummy, if (pushed_macro_table)
dummy.hash, NO_INSERT); slot = htab_find_slot_with_hash (pushed_macro_table, &dummy,
dummy.hash, NO_INSERT);
if (slot == NULL) if (slot == NULL)
return; return;
c = *slot; c = *slot;
......
2008-02-14 Danny Smith <dannysmith@users.sourceforge.net>
PR preprocessor/35061
* gcc.dg/cpp/pragma_pop_macro-1.c: New test.
2008-02-14 Paolo Carlini <pcarlini@suse.de> 2008-02-14 Paolo Carlini <pcarlini@suse.de>
PR c++/28743 PR c++/28743
/* PR preprocessor/35061 */
/* Do nothing if there is nothing on the macro stack to pop. */
/* { dg do-preprocess { target *-*-mingw* *-*-cygwin* } } */
#define X 1
/* # pragma push_macro("X") */
# undef X
# pragma pop_macro("X")
#ifdef X
#error X is defined
#endif
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