[gnu.gcc.bug] DECL_SOURCE_FILE

rfg@ICS.UCI.EDU (12/09/89)

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>";
      }