🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #860

DECL_SOURCE_FILE(x)==NULL fix

#860
From: rfg
Date: Fri, 08 Dec 1989 23:33
35 lines
1646 bytes
If you goof up and call one of the __builtin functions with the wrong
number of arguments, GCC 1.36 will deal with it properly, but G++ 1.36.1
will segfault.

The problem appears to be that the function error_with_decl() may be
called (in G++ at least) with the decl node for one of the builtin
functions (which has a null DECL_SOURCE_FILE pointer).

In order to insure that neither GCC nor G++ ever segfault because of the fact
that a decl node has a null DECL_SOURCE_FILE pointer, I suggest the following
trivial patch to tree.c.  This patch is applicable to GCC 1.36 (but your line
numbers may vary).  A similar (but different) patch should also be applied
to G++ 1.36.1.

Note that keeping DECL_SOURCE_FILE pointers non-null may also come in handy
if you are debugging GCC itself (and are calling debug_dump_tree).

// rfg

*** tree.c-	Tue Nov 28 23:37:05 1989
--- tree.c	Fri Dec  8 13:43:05 1989
***************
*** 436,440 ****
        DECL_VOFFSET_UNIT (t) = 1;
        DECL_SOURCE_LINE (t) = lineno;
!       DECL_SOURCE_FILE (t) = input_filename;
      }
  
--- 436,440 ----
        DECL_VOFFSET_UNIT (t) = 1;
        DECL_SOURCE_LINE (t) = lineno;
!       DECL_SOURCE_FILE (t) = (input_filename) ? input_filename : "<built-in>";
      }
  
Technical Details
Message-ID: <8912081533.aa22137@ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!philmtl!uunet!wuarchive!cs.utexas.edu!tut.cis.ohio-state.edu!ICS.UCI.EDU!rfg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!philmtl!uunet!wuarchive!cs.utexas.edu!tut.cis.ohio-state.edu!ICS.UCI.EDU!rfg
From: rfg@ICS.UCI.EDU
Newsgroups: gnu.gcc.bug
Subject: DECL_SOURCE_FILE(x)==NULL fix
Message-ID: <8912081533.aa22137@ICS.UCI.EDU>
Date: 8 Dec 89 23:33:05 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 35