public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch: FYI: fix PR libcpp/35322
@ 2008-03-13 21:29 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2008-03-13 21:29 UTC (permalink / raw)
  To: Gcc Patch List

I'm checking this in on the trunk.

This fixes PR libcpp/35322, an ICE with _Pragma.
The bug is that we didn't set pfile->directive while handling the
_Pragma.

Bootstrapped and regtested on the gcc compile farm.

Tom

gcc/testsuite/ChangeLog:
2008-03-13  Tom Tromey  <tromey@redhat.com>

	PR libcpp/35322:
	* gcc.dg/cpp/pr35322.c: New file.

libcpp/ChangeLog:
2008-03-13  Tom Tromey  <tromey@redhat.com>

	PR libcpp/35322:
	* directives.c (destringize_and_run): Set pfile->directive.

Index: gcc/testsuite/gcc.dg/cpp/pr35322.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr35322.c	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr35322.c	(revision 0)
@@ -0,0 +1,4 @@
+/* Test case for PR 35322 -- _Pragma ICE.  */
+
+/* { dg-do preprocess } */
+_Pragma("GCC dependency")
Index: libcpp/directives.c
===================================================================
--- libcpp/directives.c	(revision 133170)
+++ libcpp/directives.c	(working copy)
@@ -1507,6 +1507,7 @@
   tokenrun *saved_cur_run;
   cpp_token *toks;
   int count;
+  const struct directive *save_directive;
 
   dest = result = (char *) alloca (in->len - 1);
   src = in->text + 1 + (in->text[0] == 'L');
@@ -1547,8 +1548,11 @@
 
   start_directive (pfile);
   _cpp_clean_line (pfile);
+  save_directive = pfile->directive;
+  pfile->directive = &dtable[T_PRAGMA];
   do_pragma (pfile);
   end_directive (pfile, 1);
+  pfile->directive = save_directive;
 
   /* We always insert at least one token, the directive result.  It'll
      either be a CPP_PADDING or a CPP_PRAGMA.  In the later case, we 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-13 21:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-13 21:29 Patch: FYI: fix PR libcpp/35322 Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).