public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* preprocessor/4178: ICE with -imacros
@ 2001-08-30  5:16 Gert-jan Los
  0 siblings, 0 replies; 2+ messages in thread
From: Gert-jan Los @ 2001-08-30  5:16 UTC (permalink / raw)
  To: gcc-gnats; +Cc: Neil Booth

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]

>Number:         4178
>Category:       preprocessor
>Synopsis:       ICE with -imacros switch even on trivial input
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 30 05:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Gert-jan Los
>Release:        3.1 20010829 (experimental)
>Organization:
Universität Mannheim
>Environment:
System: Linux snoopy 2.2.19 #1 Thu May 31 15:16:55 CEST 2001 sparc unknown
Architecture: sparc

	
host: sparc-unknown-linux-gnu
build: sparc-unknown-linux-gnu
target: sparc-unknown-linux-gnu
configured with: /users/los/admin/software/gcc/snapshot/configure --prefix=/opt/devel --with-as=/opt/devel/bin/as --with-ld=/opt/devel/bin/ld --disable-threads --disable-nls --enable-languages=c,c++ --enable-long-long
>Description:
	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. 
>How-To-Repeat:
	
	echo >defs
	touch empty.c
	echo >onebyte.c

	gcc -imacros defs -c onebyte.c 
	| onebyte.c:-29: Internal error: Segmentation fault
	| Please submit a full bug report,
	| with preprocessed source if appropriate.
	| See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.

	gcc -imacros defs -c empty.c
	| Errors detected in input file (your bison.simple is out of date)

>Fix:
	
	Workaround: Use -include instead of -imacros
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: preprocessor/4178: ICE with -imacros
@ 2001-08-30 23:06 Neil Booth
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Booth @ 2001-08-30 23:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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)
  	{


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-08-30 23:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-30  5:16 preprocessor/4178: ICE with -imacros Gert-jan Los
2001-08-30 23:06 Neil Booth

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).