diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2008-02-14 21:41:40 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@gcc.gnu.org> | 2008-02-14 21:41:40 +0000 |
commit | 101e174d2c7f1d97a276cf951bcc6d55ecbcabdd (patch) | |
tree | cdaa87661a8e9905d3600ff02fe3ca6acec3909b /gcc/c-pragma.c | |
parent | 0cc24ff082435b48eca7ec991e18eb437d7094b7 (diff) | |
download | gcc-101e174d2c7f1d97a276cf951bcc6d55ecbcabdd.zip gcc-101e174d2c7f1d97a276cf951bcc6d55ecbcabdd.tar.gz gcc-101e174d2c7f1d97a276cf951bcc6d55ecbcabdd.tar.bz2 |
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
Diffstat (limited to 'gcc/c-pragma.c')
-rw-r--r-- | gcc/c-pragma.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index 28b4435..f7da676 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -341,7 +341,7 @@ handle_pragma_pop_macro (cpp_reader *reader) 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 @@ handle_pragma_pop_macro (cpp_reader *reader) 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; |