Re: [patch c-faimily]: Fix for PR 37215

2012-06-27 Thread Joseph S. Myers
On Wed, 27 Jun 2012, Kai Tietz wrote:

> 2012-06-27  Kai Tietz
> 
> PR preprocessor/37215
> * c-ppoutput.c (preprocess_file): Check for none-empty buffer.

"nonempty"

> Tested for x86_64-unknown-linux-gnu, and i688-pc-cygwin.  Ok for apply?

OK with the ChangeLog typo fixed.

-- 
Joseph S. Myers
jos...@codesourcery.com


[patch c-faimily]: Fix for PR 37215

2012-06-27 Thread Kai Tietz
Hello,

this patch fixes an ICE on valid code for preprocessor as described in PR 37215
ChangeLog

2012-06-27  Kai Tietz

PR preprocessor/37215
* c-ppoutput.c (preprocess_file): Check for none-empty buffer.

Tested for x86_64-unknown-linux-gnu, and i688-pc-cygwin.  Ok for apply?

Regards,
Kai

Index: c-family/c-ppoutput.c
===
--- c-family/c-ppoutput.c   (revision 183106)
+++ c-family/c-ppoutput.c   (working copy)
@@ -86,7 +86,7 @@
 {
   /* A successful cpp_read_main_file guarantees that we can call
  cpp_scan_nooutput or cpp_get_token next.  */
-  if (flag_no_output)
+  if (flag_no_output && pfile->buffer)
 {
   /* Scan -included buffers, then the main file.  */
   while (pfile->buffer->prev)