public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Neil Booth <neil@daikokuya.demon.co.uk>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org
Subject: Re: preprocessor/4178: ICE with -imacros
Date: Thu, 30 Aug 2001 23:06:00 -0000	[thread overview]
Message-ID: <20010831060628.5390.qmail@sourceware.cygnus.com> (raw)

The following reply was made to PR preprocessor/4178; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.demon.co.uk>
To: Gert-jan Los <gjlos@rz.uni-mannheim.de>
Cc: gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: preprocessor/4178: ICE with -imacros
Date: Thu, 30 Aug 2001 22:45:01 +0100

 Gert-jan Los wrote:-
 
 > 	GCC dies with an ICE even on trivial input if the -imacros switch is
 > 	used.
 > 	I suspect an oversight in the recent line mapping changes, because of
 > 	the negative line number in the error message. 
 
 Thanks for the bug report.
 
 No, it's just silly lossage in handling the internal linked lists of
 directives.
 
 This patch is not great; its only redeeming feature is that I think it
 fixes the bug.  Sometime in the next few days, when I'm a little less
 inebriated and have some spare time, I'll fix it properly 8-)
 
 I'm running a bootstrap now.  Let me know if this cures whatever code
 you have that caused you to notice the bug originally, and I'll commit
 it.
 
 I must find a way of getting -imacros and -include tests into dejagnu.
 They need to take absolute paths, which means I have no clue how to
 add tests for them...
 
 Neil.
 
 	* cppinit.c (cpp_start_read): Free the imacros list as we
 	traverse it.  Don't free the chains before returning.
 	(_cpp_push_next_buffer): Only try pushing buffers if we've
 	completed -imacros handling.
 
 Index: cppinit.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/cppinit.c,v
 retrieving revision 1.176
 diff -u -p -r1.176 cppinit.c
 --- cppinit.c	2001/08/22 20:37:18	1.176
 +++ cppinit.c	2001/08/30 21:43:14
 @@ -958,18 +958,19 @@ cpp_start_read (pfile, fname)
  
        /* Scan -imacros files after command line defines, but before
  	 files given with -include.  */
 -      for (p = CPP_OPTION (pfile, pending)->imacros_head; p; p = p->next)
 +      while ((p = CPP_OPTION (pfile, pending)->imacros_head) != NULL)
  	{
  	  if (push_include (pfile, p))
  	    {
  	      pfile->buffer->return_at_eof = true;
  	      cpp_scan_nooutput (pfile);
  	    }
 +	  CPP_OPTION (pfile, pending)->imacros_head = p->next;
 +	  free (p);
  	}
      }
  
    free_chain (CPP_OPTION (pfile, pending)->directive_head);
 -  free_chain (CPP_OPTION (pfile, pending)->imacros_head);
    _cpp_push_next_buffer (pfile);
  
    return 1;
 @@ -984,7 +985,12 @@ _cpp_push_next_buffer (pfile)
  {
    bool pushed = false;
  
 -  if (CPP_OPTION (pfile, pending))
 +  /* This is't pretty; we'd rather not be relying on this as a boolean
 +     for reverting the line map.  Further, we only free the chains in
 +     this conditional, so an early call to cpp_finish / cpp_destroy
 +     will leak that memory.  */
 +  if (CPP_OPTION (pfile, pending)
 +      && CPP_OPTION (pfile, pending)->imacros_head == NULL)
      {
        while (!pushed)
  	{


             reply	other threads:[~2001-08-30 23:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-30 23:06 Neil Booth [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-08-30  5:16 Gert-jan Los

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010831060628.5390.qmail@sourceware.cygnus.com \
    --to=neil@daikokuya.demon.co.uk \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).