This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[diagnostics] add location to build_decl()


The patch from hell.  

This patch adds location to build_decl(), and it's as boring as it
sounds.  Thankfully though, it fixes some previously incorrect
diagnostics in the testsuite, not to mention that we now have correct
location information for most C decls.

I fixed virtually all places in the C front-end with correct location,
but I punted on the rest of the front-ends since I'm not certain which
location to use for most cases.  I could certainly use FE maintainer
help for these FEs.  The patch currently uses input_location for these
FEs.

The plan is to use an actual location when appropriate, UNKNOWN_LOCATION
if we're sure we'll never need this location or if it's impossible to
know, and BUILTINS_LOCATION if this is a builtin decl.  In some places,
it's best to use the current function's DECL_SOURCE_LOCATION to
associate a dangling location with the currently compiled function.

(Ideally I'd like to remove input_location in favor of passing locations
as arguments to functions.  But this is merely a secondary goal.  If
input_location is correct for some build_decl() calls, then by all
means, we'll use it.  I'm concentrating on correct location first.)

Tested on x86-64 Linux for both the GCC and GDB testsuites.

Aldy

	* dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h,
	builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c,
	tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c,
	c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c,
	c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c,
	emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c,
	rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h,
	tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c,
	config/i386/i386.c, stmt.c:
	Add location argument to the following function definitions and/or
	function calls: build_decl, objcp_start_struct, objcp_finish_struct,
	start_struct, finish_struct, PUSH_FIELD, create_artificial_label,
	cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl,
	build_compound_literal, parser_xref_tag, resolve_overloaded_builtin,
	do_case, c_finish_bc_stmt, build_compound_literal,
	build_function_call.
	* c-decl.c (build_compound_literal): Add location argument.
	Make all diagnostic calls use location.
	(start_struct): Same.
	(finish_struct): Same.
	(start_enum): Same.
	(build_enumerator): Same.
	(start_function): Same.
	(grokdeclarator): Make all diagnostic calls use location.
	(store_parm_decls_oldstyle): Same.
	* c-typeck.c (build_function_call): Add location argument.
	Make all diagnostic calls use location.
	(do_case): Same.
	(c_finish_bc_stmt): Same.
	* tree-nested.c (get_trampoline_type): Add argument.
	Pass location to build_decl.
	(lookup_tramp_for_decl): Pass location to get_trampoline_type.
	* rtl.h (RTL_LOCATION): New.
	* c-common.c (c_add_case_label): Add location argument.
	Make all diagnostic calls use location.
	* c-common.h: Add location argument to make_fname_decl, do_case,
	c_add_case_label, build_function_call, resolve_overloaded_builtin.
	* c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc.
	Set it appropriately for every case.  Pass enum_loc to start_enum
	call.  Pass value_loc first to build_enumerator.  Pass enum_loc to
	parser_xref_tag.
	(c_parser_struct_or_union_specifier): Save location.  Use it for
	start_struct, finish_struct, and parser_xref_tag.
java/
	* typeck.c: Add location to build_decl or PUSH_FIELD calls.
	* class.c: Same.
	* decl.c: Same.
	* jcf-parse.c: Same.
	* constants.c: Same.
	* resource.c: Same.
	* except.c: Same.
	* builtins.c: Same.
	* expr.c: Same.
	* java-tree.h (PUSH_FIELD): Add location field.
objc/
	* objc-act.c: Add location to all calls to start_struct, build_decl,
	finish_struct.
testsuite/
	* gcc.dg/old-style-prom-3.c: Check for error on the correct line.
	* gcc.dg/enum-compat-1.c: Same.
	* gcc.dg/dremf-type-compat-2.c: Same.
	* gcc.dg/old-style-prom-2.c: Same.
	* gcc.dg/pr15698-1.c: Same.
	* gcc.dg/pr20368-1.c: Same.
	* gcc.dg/dremf-type-compat-3.c: Same.
	* gcc.dg/builtins-30.c: Same.  Test for columns.
objcp/
	* objcp-decl.c (objcp_start_struct): Add argument.
	(objcp_finish_struct): Same.
cp/
	* typeck.c (build_function_call): Add location argument.
	* init.c: Add location argument to all build_decl calls.
	* class.c: Same.
	* method.c: Same.
	* rtti.c: Same.
	* tree.c: Same.
	* pt.c: Same.
	* semantics.c: Same.
	* lex.c: Same.
	* decl2.c: Same.
	* cp-gimplify.c: Same.
	* decl.c: Same.
	(cp_make_fname_decl): Add location argument.  Pass location ot
	build_decl.
	(finish_case_label): Same.
	* cp-tree.h (finish_case_label): Add location argument.
	* parser.c (cp_parser_label_for_labeled_statement): Pass location to
	finish_case_label.

Index: dwarf2asm.c
===================================================================
--- dwarf2asm.c	(revision 141983)
+++ dwarf2asm.c	(working copy)
@@ -832,7 +832,8 @@ dw2_force_const_mem (rtx x, bool is_publ
 
 	  sprintf (ref_name, "DW.ref.%s", str);
 	  id = get_identifier (ref_name);
-	  decl = build_decl (VAR_DECL, id, ptr_type_node);
+	  decl = build_decl (input_location,
+			     VAR_DECL, id, ptr_type_node);
 	  DECL_ARTIFICIAL (decl) = 1;
 	  DECL_IGNORED_P (decl) = 1;
 	  TREE_PUBLIC (decl) = 1;
@@ -846,7 +847,8 @@ dw2_force_const_mem (rtx x, bool is_publ
 	  ASM_GENERATE_INTERNAL_LABEL (label, "LDFCM", dw2_const_labelno);
 	  ++dw2_const_labelno;
 	  id = get_identifier (label);
-	  decl = build_decl (VAR_DECL, id, ptr_type_node);
+	  decl = build_decl (input_location,
+			     VAR_DECL, id, ptr_type_node);
 	  DECL_ARTIFICIAL (decl) = 1;
 	  DECL_IGNORED_P (decl) = 1;
 	  TREE_STATIC (decl) = 1;
Index: targhooks.c
===================================================================
--- targhooks.c	(revision 141983)
+++ targhooks.c	(working copy)
@@ -453,7 +453,8 @@ default_stack_protect_guard (void)
 
   if (t == NULL)
     {
-      t = build_decl (VAR_DECL, get_identifier ("__stack_chk_guard"),
+      t = build_decl (UNKNOWN_LOCATION,
+		      VAR_DECL, get_identifier ("__stack_chk_guard"),
 		      ptr_type_node);
       TREE_STATIC (t) = 1;
       TREE_PUBLIC (t) = 1;
@@ -479,7 +480,8 @@ default_external_stack_protect_fail (voi
   if (t == NULL_TREE)
     {
       t = build_function_type_list (void_type_node, NULL_TREE);
-      t = build_decl (FUNCTION_DECL, get_identifier ("__stack_chk_fail"), t);
+      t = build_decl (UNKNOWN_LOCATION,
+		      FUNCTION_DECL, get_identifier ("__stack_chk_fail"), t);
       TREE_STATIC (t) = 1;
       TREE_PUBLIC (t) = 1;
       DECL_EXTERNAL (t) = 1;
@@ -511,7 +513,7 @@ default_hidden_stack_protect_fail (void)
   if (t == NULL_TREE)
     {
       t = build_function_type_list (void_type_node, NULL_TREE);
-      t = build_decl (FUNCTION_DECL,
+      t = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL,
 		      get_identifier ("__stack_chk_fail_local"), t);
       TREE_STATIC (t) = 1;
       TREE_PUBLIC (t) = 1;
Index: java/typeck.c
===================================================================
--- java/typeck.c	(revision 141983)
+++ java/typeck.c	(working copy)
@@ -347,7 +347,7 @@ build_java_array_type (tree element_type
       strcpy (suffix, "[]");
     TYPE_NAME (t) 
       = TYPE_STUB_DECL (t)
-      = build_decl (TYPE_DECL,
+      = build_decl (input_location, TYPE_DECL,
 		    identifier_subst (el_name, "", '.', '.', suffix),
                              t);
     TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (t)) = true;
@@ -360,7 +360,8 @@ build_java_array_type (tree element_type
   TYPE_ARRAY_ELEMENT (t) = element_type;
 
   /* Add length pseudo-field. */
-  fld = build_decl (FIELD_DECL, get_identifier ("length"), int_type_node);
+  fld = build_decl (input_location,
+		    FIELD_DECL, get_identifier ("length"), int_type_node);
   TYPE_FIELDS (t) = fld;
   DECL_CONTEXT (fld) = t;
   FIELD_PUBLIC (fld) = 1;
@@ -368,7 +369,8 @@ build_java_array_type (tree element_type
   TREE_READONLY (fld) = 1;
 
   atype = build_prim_array_type (element_type, length);
-  arfld = build_decl (FIELD_DECL, get_identifier ("data"), atype);
+  arfld = build_decl (input_location,
+		      FIELD_DECL, get_identifier ("data"), atype);
   DECL_CONTEXT (arfld) = t;
   TREE_CHAIN (fld) = arfld;
   DECL_ALIGN (arfld) = TYPE_ALIGN (element_type);
Index: java/class.c
===================================================================
--- java/class.c	(revision 141983)
+++ java/class.c	(working copy)
@@ -420,7 +420,7 @@ do									\
 									\
   sprintf (buf, #NAME "_%s", type_name);				\
   TYPE_## TABLE ##_DECL (type) = decl =					\
-    build_decl (VAR_DECL, get_identifier (buf), TABLE_TYPE);		\
+    build_decl (input_location, VAR_DECL, get_identifier (buf), TABLE_TYPE); \
   DECL_EXTERNAL (decl) = 1;						\
   TREE_STATIC (decl) = 1;						\
   TREE_READONLY (decl) = 1;						\
@@ -432,7 +432,7 @@ do									\
   DECL_OWNER (decl) = TYPE;						\
   sprintf (buf, #NAME "_syms_%s", type_name);				\
   TYPE_## TABLE ##_SYMS_DECL (TYPE) =					\
-    build_decl (VAR_DECL, get_identifier (buf), symbols_array_type);	\
+    build_decl (input_location, VAR_DECL, get_identifier (buf), symbols_array_type); \
   TREE_STATIC (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1;			\
   TREE_CONSTANT (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1;		\
   DECL_IGNORED_P (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1;		\
@@ -452,12 +452,14 @@ gen_indirect_dispatch_tables (tree type)
     tree catch_class_type = make_node (RECORD_TYPE);
 
     sprintf (buf, "_catch_classes_%s", type_name);
-    PUSH_FIELD (catch_class_type, field, "address", utf8const_ptr_type);
-    PUSH_FIELD (catch_class_type, field, "classname", ptr_type_node);
+    PUSH_FIELD (input_location,
+		catch_class_type, field, "address", utf8const_ptr_type);
+    PUSH_FIELD (input_location,
+		catch_class_type, field, "classname", ptr_type_node);
     FINISH_RECORD (catch_class_type);
     
     TYPE_CTABLE_DECL (type) 
-      = build_decl (VAR_DECL, get_identifier (buf),
+      = build_decl (input_location, VAR_DECL, get_identifier (buf),
 		    build_array_type (catch_class_type, 0));
     DECL_EXTERNAL (TYPE_CTABLE_DECL (type)) = 1;
     TREE_STATIC (TYPE_CTABLE_DECL (type)) = 1;
@@ -483,7 +485,7 @@ push_class (tree class_type, tree class_
   tree decl, signature;
   location_t saved_loc = input_location;
   CLASS_P (class_type) = 1;
-  decl = build_decl (TYPE_DECL, class_name, class_type);
+  decl = build_decl (input_location, TYPE_DECL, class_name, class_type);
   TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
 
   /* dbxout needs a DECL_SIZE if in gstabs mode */
@@ -758,7 +760,7 @@ add_method_1 (tree this_class, int acces
   method_type = build_java_method_type (function_type,
 					this_class, access_flags);
 
-  fndecl = build_decl (FUNCTION_DECL, name, method_type);
+  fndecl = build_decl (input_location, FUNCTION_DECL, name, method_type);
   DECL_CONTEXT (fndecl) = this_class;
 
   DECL_LANG_SPECIFIC (fndecl)
@@ -844,7 +846,8 @@ add_field (tree klass, tree name, tree f
 {
   int is_static = (flags & ACC_STATIC) != 0;
   tree field;
-  field = build_decl (is_static ? VAR_DECL : FIELD_DECL, name, field_type);
+  field = build_decl (input_location,
+		      is_static ? VAR_DECL : FIELD_DECL, name, field_type);
   TREE_CHAIN (field) = TYPE_FIELDS (klass);
   TYPE_FIELDS (klass) = field;
   DECL_CONTEXT (field) = klass;
@@ -948,9 +951,10 @@ build_utf8_ref (tree name)
 	     - (name_len & (TYPE_ALIGN_UNIT (utf8const_type) - 1));
   str_type = build_prim_array_type (unsigned_byte_type_node,
 				    name_len + name_pad);
-  PUSH_FIELD (ctype, field, "hash", unsigned_short_type_node);
-  PUSH_FIELD (ctype, field, "length", unsigned_short_type_node);
-  PUSH_FIELD (ctype, field, "data", str_type);
+  PUSH_FIELD (input_location, ctype, field, "hash", unsigned_short_type_node);
+  PUSH_FIELD (input_location,
+	      ctype, field, "length", unsigned_short_type_node);
+  PUSH_FIELD (input_location, ctype, field, "data", str_type);
   FINISH_RECORD (ctype);
   START_RECORD_CONSTRUCTOR (cinit, ctype);
   name_hash = hashUtf8String (name_ptr, name_len) & 0xFFFF;
@@ -965,7 +969,8 @@ build_utf8_ref (tree name)
   /* Generate a unique-enough identifier.  */
   sprintf(buf, "_Utf%d", ++utf8_count);
 
-  decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_type);
+  decl = build_decl (input_location,
+		     VAR_DECL, get_identifier (buf), utf8const_type);
   TREE_STATIC (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
   DECL_IGNORED_P (decl) = 1;
@@ -1027,7 +1032,7 @@ build_static_class_ref (tree type)
   decl = IDENTIFIER_GLOBAL_VALUE (decl_name);
   if (decl == NULL_TREE)
     {
-      decl = build_decl (VAR_DECL, decl_name, class_type_node);
+      decl = build_decl (input_location, VAR_DECL, decl_name, class_type_node);
       TREE_STATIC (decl) = 1;
       if (! flag_indirect_classes)
 	{
@@ -1062,7 +1067,8 @@ build_classdollar_field (tree type)
   if (decl == NULL_TREE)
     {
       decl 
-	= build_decl (VAR_DECL, decl_name, 
+	= build_decl (input_location,
+		      VAR_DECL, decl_name, 
 		      (build_type_variant 
 		       (build_pointer_type 
 			(build_type_variant (class_type_node, 
@@ -1097,7 +1103,8 @@ cache_this_class_ref (tree fndecl)
       else
 	classdollar_field = build_static_class_ref (output_class);
 
-      this_classdollar = build_decl (VAR_DECL, NULL_TREE, 
+      this_classdollar = build_decl (input_location,
+				     VAR_DECL, NULL_TREE, 
 				     TREE_TYPE (classdollar_field));
       
       java_add_local_var (this_classdollar);
@@ -1175,7 +1182,8 @@ build_class_ref (tree type)
 	  decl = IDENTIFIER_GLOBAL_VALUE (decl_name);
 	  if (decl == NULL_TREE)
 	    {
-	      decl = build_decl (VAR_DECL, decl_name, class_type_node);
+	      decl = build_decl (input_location,
+				 VAR_DECL, decl_name, class_type_node);
 	      TREE_STATIC (decl) = 1;
 	      TREE_PUBLIC (decl) = 1;
 	      DECL_EXTERNAL (decl) = 1;
@@ -1205,7 +1213,8 @@ build_fieldref_cache_entry (int index, t
   decl = IDENTIFIER_GLOBAL_VALUE (decl_name);
   if (decl == NULL_TREE)
     {
-      decl = build_decl (VAR_DECL, decl_name, ptr_type_node);
+      decl = build_decl (input_location,
+			 VAR_DECL, decl_name, ptr_type_node);
       TREE_STATIC (decl) = 1;
       TREE_PUBLIC (decl) = 0;
       DECL_EXTERNAL (decl) = 0;
@@ -1386,7 +1395,8 @@ make_local_function_alias (tree method)
   strcpy (name + 1, method_name);
 
   ASM_GENERATE_INTERNAL_LABEL (buf, name, alias_labelno++);  
-  alias = build_decl (FUNCTION_DECL, get_identifier (buf),
+  alias = build_decl (input_location,
+		      FUNCTION_DECL, get_identifier (buf),
 		      TREE_TYPE (method));
   DECL_CONTEXT (alias) = NULL;
   TREE_READONLY (alias) = TREE_READONLY (method);
@@ -1530,7 +1540,8 @@ make_method_value (tree mdecl)
 	table = build_constructor_from_list (type, table);
 	/* Compute something unique enough.  */
 	sprintf (buf, "_methods%d", method_name_count++);
-	array = build_decl (VAR_DECL, get_identifier (buf), type);
+	array = build_decl (input_location,
+			    VAR_DECL, get_identifier (buf), type);
 	DECL_INITIAL (array) = table;
 	TREE_STATIC (array) = 1;
 	DECL_ARTIFICIAL (array) = 1;
@@ -1862,7 +1873,8 @@ make_class_data (tree type)
       instance_fields = nreverse (instance_fields);
       static_fields = chainon (static_fields, instance_fields);
       field_array_type = build_prim_array_type (field_type_node, field_count);
-      fields_decl = build_decl (VAR_DECL, mangled_classname ("_FL_", type),
+      fields_decl = build_decl (input_location,
+				VAR_DECL, mangled_classname ("_FL_", type),
 				field_array_type);
       DECL_INITIAL (fields_decl) = build_constructor_from_list
 				    (field_array_type, static_fields);
@@ -1918,7 +1930,8 @@ make_class_data (tree type)
         }
     }
   method_array_type = build_prim_array_type (method_type_node, method_count);
-  methods_decl = build_decl (VAR_DECL, mangled_classname ("_MT_", type),
+  methods_decl = build_decl (input_location,
+			     VAR_DECL, mangled_classname ("_MT_", type),
 			     method_array_type);
   DECL_INITIAL (methods_decl) = build_constructor_from_list
 				 (method_array_type, nreverse (methods));
@@ -1964,7 +1977,8 @@ make_class_data (tree type)
       tree interface_array_type, idecl;
       interface_array_type
 	= build_prim_array_type (class_ptr_type, interface_len);
-      idecl = build_decl (VAR_DECL, mangled_classname ("_IF_", type),
+      idecl = build_decl (input_location,
+			  VAR_DECL, mangled_classname ("_IF_", type),
 			  interface_array_type);
       
       for (i = interface_len;  i > 0; i--)
@@ -2168,7 +2182,8 @@ make_class_data (tree type)
       static int reflection_data_count;
 
       sprintf (buf, "_reflection_data_%d", reflection_data_count++);
-      array = build_decl (VAR_DECL, get_identifier (buf), type);
+      array = build_decl (input_location,
+			  VAR_DECL, get_identifier (buf), type);
 
       rewrite_reflection_indexes (field_indexes);
 
@@ -2298,23 +2313,25 @@ build_dtable_decl (tree type)
 
       dtype = make_node (RECORD_TYPE);
 
-      PUSH_FIELD (dtype, dummy, "top_offset", ptr_type_node);
-      PUSH_FIELD (dtype, dummy, "type_info", ptr_type_node);
+      PUSH_FIELD (input_location, dtype, dummy, "top_offset", ptr_type_node);
+      PUSH_FIELD (input_location, dtype, dummy, "type_info", ptr_type_node);
 
-      PUSH_FIELD (dtype, dummy, "class", class_ptr_type);
+      PUSH_FIELD (input_location, dtype, dummy, "class", class_ptr_type);
       for (n = 1; n < TARGET_VTABLE_USES_DESCRIPTORS; ++n)
 	{
-	  tree tmp_field = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node);
+	  tree tmp_field = build_decl (input_location,
+				       FIELD_DECL, NULL_TREE, ptr_type_node);
 	  TREE_CHAIN (dummy) = tmp_field;
 	  DECL_CONTEXT (tmp_field) = dtype;
 	  DECL_ARTIFICIAL (tmp_field) = 1;
 	  dummy = tmp_field;
 	}
 
-      PUSH_FIELD (dtype, dummy, "gc_descr", ptr_type_node);
+      PUSH_FIELD (input_location, dtype, dummy, "gc_descr", ptr_type_node);
       for (n = 1; n < TARGET_VTABLE_USES_DESCRIPTORS; ++n)
 	{
-	  tree tmp_field = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node);
+	  tree tmp_field = build_decl (input_location,
+				       FIELD_DECL, NULL_TREE, ptr_type_node);
 	  TREE_CHAIN (dummy) = tmp_field;
 	  DECL_CONTEXT (tmp_field) = dtype;
 	  DECL_ARTIFICIAL (tmp_field) = 1;
@@ -2325,14 +2342,15 @@ build_dtable_decl (tree type)
       if (TARGET_VTABLE_USES_DESCRIPTORS)
 	n *= TARGET_VTABLE_USES_DESCRIPTORS;
 
-      PUSH_FIELD (dtype, dummy, "methods",
+      PUSH_FIELD (input_location, dtype, dummy, "methods",
 		  build_prim_array_type (nativecode_ptr_type_node, n));
       layout_type (dtype);
     }
   else
     dtype = dtable_type;
 
-  decl = build_decl (VAR_DECL, get_identifier ("vt$"), dtype);
+  decl = build_decl (input_location,
+		     VAR_DECL, get_identifier ("vt$"), dtype);
   DECL_CONTEXT (decl) = type;
   MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
   DECL_VTABLE_P (decl) = 1;
@@ -2350,7 +2368,8 @@ push_super_field (tree this_class, tree 
   /* Don't insert the field if we're just re-laying the class out. */ 
   if (TYPE_FIELDS (this_class) && !DECL_NAME (TYPE_FIELDS (this_class)))
     return;
-  base_decl = build_decl (FIELD_DECL, NULL_TREE, super_class);
+  base_decl = build_decl (input_location,
+			  FIELD_DECL, NULL_TREE, super_class);
   DECL_IGNORED_P (base_decl) = 1;
   TREE_CHAIN (base_decl) = TYPE_FIELDS (this_class);
   TYPE_FIELDS (this_class) = base_decl;
@@ -2719,7 +2738,8 @@ emit_indirect_register_classes (tree *li
   int size = VEC_length (tree, registered_class) * 2 + 1;
   tree class_array_type
     = build_prim_array_type (ptr_type_node, size);
-  tree cdecl = build_decl (VAR_DECL, get_identifier ("_Jv_CLS"),
+  tree cdecl = build_decl (input_location,
+			   VAR_DECL, get_identifier ("_Jv_CLS"),
 			   class_array_type);
   tree reg_class_list;
   for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
@@ -2747,7 +2767,8 @@ emit_indirect_register_classes (tree *li
 
   t = build_function_type_list (void_type_node, 
 				build_pointer_type (ptr_type_node), NULL);
-  t = build_decl (FUNCTION_DECL, 
+  t = build_decl (input_location,
+		  FUNCTION_DECL, 
 		  get_identifier ("_Jv_RegisterNewClasses"), t);
   TREE_PUBLIC (t) = 1;
   DECL_EXTERNAL (t) = 1;
@@ -2809,7 +2830,8 @@ emit_register_classes (tree *list_p)
       int i;
 
       t = build_function_type_list (void_type_node, class_ptr_type, NULL);
-      t = build_decl (FUNCTION_DECL, get_identifier ("_Jv_RegisterClass"), t);
+      t = build_decl (input_location,
+		      FUNCTION_DECL, get_identifier ("_Jv_RegisterClass"), t);
       TREE_PUBLIC (t) = 1;
       DECL_EXTERNAL (t) = 1;
       register_class_fn = t;
@@ -2915,7 +2937,8 @@ emit_symbol_table (tree name, tree the_t
   table_size 
     = build_index_type (build_int_cst (NULL_TREE, index * element_size + 1));
   the_array_type = build_array_type (the_array_element_type, table_size);
-  the_table = build_decl (VAR_DECL, name, the_array_type);
+  the_table = build_decl (input_location,
+			  VAR_DECL, name, the_array_type);
   TREE_STATIC (the_table) = 1;
   TREE_READONLY (the_table) = 1;  
   rest_of_decl_compilation (the_table, 1, 0);
@@ -2959,7 +2982,8 @@ emit_catch_table (tree this_class)
     = build_array_type (TREE_TYPE (TREE_TYPE (TYPE_CTABLE_DECL (this_class))),
 			table_size);
   table = 
-    build_decl (VAR_DECL, DECL_NAME (TYPE_CTABLE_DECL (this_class)), array_type);
+    build_decl (input_location,
+		VAR_DECL, DECL_NAME (TYPE_CTABLE_DECL (this_class)), array_type);
   DECL_INITIAL (table) = 
     build_constructor_from_list (array_type, TYPE_CATCH_CLASSES (this_class));
   TREE_STATIC (table) = 1;
@@ -3043,7 +3067,8 @@ emit_assertion_table (tree klass)
   list = nreverse (list);
   ctor = build_constructor_from_list (assertion_table_type, list);
 
-  table_decl = build_decl (VAR_DECL, mangled_classname ("_type_assert_", klass),
+  table_decl = build_decl (input_location,
+			   VAR_DECL, mangled_classname ("_type_assert_", klass),
 			   assertion_table_type);
 
   TREE_STATIC (table_decl) = 1;
Index: java/decl.c
===================================================================
--- java/decl.c	(revision 141983)
+++ java/decl.c	(working copy)
@@ -274,7 +274,7 @@ find_local_variable (int index, tree typ
       tree name;
       sprintf (buf, "#slot#%d#%d", index, uniq++);
       name = get_identifier (buf);
-      decl = build_decl (VAR_DECL, name, type);
+      decl = build_decl (input_location, VAR_DECL, name, type);
       DECL_IGNORED_P (decl) = 1;
       DECL_ARTIFICIAL (decl) = 1;
       decl = push_jvm_slot (index, decl);
@@ -297,7 +297,7 @@ find_local_variable (int index, tree typ
       name = get_identifier (buf);
       base_decl
 	= TREE_VEC_ELT (base_decl_map, index)
-	= build_decl (VAR_DECL, name, ptr_type_node);
+	= build_decl (input_location, VAR_DECL, name, ptr_type_node);
       pushdecl_function_level (base_decl);
       DECL_IGNORED_P (base_decl) = 1;
       DECL_ARTIFICIAL (base_decl) = 1;
@@ -450,7 +450,8 @@ push_promoted_type (const char *name, tr
   TYPE_PRECISION (type) = TYPE_PRECISION (int_type_node);
   TYPE_STRING_FLAG (type) = TYPE_STRING_FLAG (actual_type);
   layout_type (type);
-  pushdecl (build_decl (TYPE_DECL, get_identifier (name), type));
+  pushdecl (build_decl (input_location,
+			TYPE_DECL, get_identifier (name), type));
   return type;
 }
 
@@ -462,7 +463,8 @@ create_primitive_vtable (const char *nam
   char buf[50];
 
   sprintf (buf, "_Jv_%sVTable", name);
-  r = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node);
+  r = build_decl (input_location,
+		  VAR_DECL, get_identifier (buf), ptr_type_node);
   DECL_EXTERNAL (r) = 1;
   return r;
 }
@@ -545,25 +547,33 @@ java_init_decl_processing (void)
   initialize_sizetypes (false);
 
   byte_type_node = make_signed_type (8);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("byte"), byte_type_node));
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("byte"), byte_type_node));
   short_type_node = make_signed_type (16);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("short"), short_type_node));
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("short"), short_type_node));
   int_type_node = make_signed_type (32);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("int"), int_type_node));
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("int"), int_type_node));
   long_type_node = make_signed_type (64);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("long"), long_type_node));
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("long"), long_type_node));
 
   unsigned_byte_type_node = make_unsigned_type (8);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned byte"),
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("unsigned byte"),
 			unsigned_byte_type_node));
   unsigned_short_type_node = make_unsigned_type (16);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned short"),
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("unsigned short"),
 			unsigned_short_type_node));
   unsigned_int_type_node = make_unsigned_type (32);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"),
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("unsigned int"),
 			unsigned_int_type_node));
   unsigned_long_type_node = make_unsigned_type (64);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned long"),
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("unsigned long"),
 			unsigned_long_type_node));
 
   /* This is not a java type, however tree-dfa requires a definition for
@@ -600,7 +610,8 @@ java_init_decl_processing (void)
   long_zero_node = build_int_cst (long_type_node, 0);
 
   void_type_node = make_node (VOID_TYPE);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("void"), void_type_node));
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("void"), void_type_node));
   layout_type (void_type_node);	/* Uses size_zero_node */
 
   ptr_type_node = build_pointer_type (void_type_node);
@@ -617,12 +628,14 @@ java_init_decl_processing (void)
   TYPE_STRING_FLAG (char_type_node) = 1;
   TYPE_PRECISION (char_type_node) = 16;
   fixup_unsigned_type (char_type_node);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), char_type_node));
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("char"), char_type_node));
 
   boolean_type_node = make_node (BOOLEAN_TYPE);
   TYPE_PRECISION (boolean_type_node) = 1;
   fixup_unsigned_type (boolean_type_node);
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("boolean"),
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("boolean"),
 			boolean_type_node));
   boolean_false_node = TYPE_MIN_VALUE (boolean_type_node);
   boolean_true_node = TYPE_MAX_VALUE (boolean_type_node);
@@ -638,13 +651,15 @@ java_init_decl_processing (void)
 
   float_type_node = make_node (REAL_TYPE);
   TYPE_PRECISION (float_type_node) = 32;
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("float"),
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("float"),
                         float_type_node));
   layout_type (float_type_node);
 
   double_type_node = make_node (REAL_TYPE);
   TYPE_PRECISION (double_type_node) = 64;
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("double"),
+  pushdecl (build_decl (BUILTINS_LOCATION,
+			TYPE_DECL, get_identifier ("double"),
                         double_type_node));
   layout_type (double_type_node);
 
@@ -663,8 +678,10 @@ java_init_decl_processing (void)
 
   one_elt_array_domain_type = build_index_type (integer_one_node);
   utf8const_type = make_node (RECORD_TYPE);
-  PUSH_FIELD (utf8const_type, field, "hash", unsigned_short_type_node);
-  PUSH_FIELD (utf8const_type, field, "length", unsigned_short_type_node);
+  PUSH_FIELD (input_location,
+	      utf8const_type, field, "hash", unsigned_short_type_node);
+  PUSH_FIELD (input_location,
+	      utf8const_type, field, "length", unsigned_short_type_node);
   FINISH_RECORD (utf8const_type);
   utf8const_ptr_type = build_pointer_type (utf8const_type);
 
@@ -679,9 +696,11 @@ java_init_decl_processing (void)
   itable_ptr_type = build_pointer_type (itable_type);
 
   symbol_type = make_node (RECORD_TYPE);
-  PUSH_FIELD (symbol_type, field, "clname", utf8const_ptr_type);
-  PUSH_FIELD (symbol_type, field, "name", utf8const_ptr_type);
-  PUSH_FIELD (symbol_type, field, "signature", utf8const_ptr_type);
+  PUSH_FIELD (input_location,
+	      symbol_type, field, "clname", utf8const_ptr_type);
+  PUSH_FIELD (input_location, symbol_type, field, "name", utf8const_ptr_type);
+  PUSH_FIELD (input_location,
+	      symbol_type, field, "signature", utf8const_ptr_type);
   FINISH_RECORD (symbol_type);
 
   symbols_array_type = build_array_type (symbol_type, 
@@ -689,9 +708,12 @@ java_init_decl_processing (void)
   symbols_array_ptr_type = build_pointer_type (symbols_array_type);
 
   assertion_entry_type = make_node (RECORD_TYPE);
-  PUSH_FIELD (assertion_entry_type, field, "assertion_code", integer_type_node);
-  PUSH_FIELD (assertion_entry_type, field, "op1", utf8const_ptr_type);
-  PUSH_FIELD (assertion_entry_type, field, "op2", utf8const_ptr_type);
+  PUSH_FIELD (input_location,
+	      assertion_entry_type, field, "assertion_code", integer_type_node);
+  PUSH_FIELD (input_location,
+	      assertion_entry_type, field, "op1", utf8const_ptr_type);
+  PUSH_FIELD (input_location,
+	      assertion_entry_type, field, "op2", utf8const_ptr_type);
   FINISH_RECORD (assertion_entry_type);
   
   assertion_table_type = build_array_type (assertion_entry_type,
@@ -729,7 +751,8 @@ java_init_decl_processing (void)
 
   methodtable_type = make_node (RECORD_TYPE);
   layout_type (methodtable_type);
-  build_decl (TYPE_DECL, get_identifier ("methodtable"), methodtable_type);
+  build_decl (BUILTINS_LOCATION,
+	      TYPE_DECL, get_identifier ("methodtable"), methodtable_type);
   methodtable_ptr_type = build_pointer_type (methodtable_type);
 
   TYPE_identifier_node = get_identifier ("TYPE");
@@ -747,12 +770,16 @@ java_init_decl_processing (void)
   init_expr_processing();
 
   constants_type_node = make_node (RECORD_TYPE);
-  PUSH_FIELD (constants_type_node, field, "size", unsigned_int_type_node);
-  PUSH_FIELD (constants_type_node, field, "tags", ptr_type_node);
-  PUSH_FIELD (constants_type_node, field, "data", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      constants_type_node, field, "size", unsigned_int_type_node);
+  PUSH_FIELD (input_location,
+	      constants_type_node, field, "tags", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      constants_type_node, field, "data", ptr_type_node);
   constants_data_field_decl_node = field;
   FINISH_RECORD (constants_type_node);
-  build_decl (TYPE_DECL, get_identifier ("constants"), constants_type_node);
+  build_decl (BUILTINS_LOCATION,
+	      TYPE_DECL, get_identifier ("constants"), constants_type_node);
 
   access_flags_type_node = unsigned_short_type_node;
 
@@ -764,7 +791,8 @@ java_init_decl_processing (void)
   TYPE_NONALIASED_COMPONENT (otable_type) = 1;
   otable_ptr_type = build_pointer_type (otable_type);
 
-  PUSH_FIELD (object_type_node, field, "vtable", dtable_ptr_type);
+  PUSH_FIELD (input_location,
+	      object_type_node, field, "vtable", dtable_ptr_type);
   DECL_FCONTEXT (field) = object_type_node;
   TYPE_VFIELD (object_type_node) = field;
 
@@ -772,7 +800,7 @@ java_init_decl_processing (void)
      There is an unresolved issue here, which is whether the vtable
      should be marked by the GC.  */
   if (! flag_hash_synchronization)
-    PUSH_FIELD (object_type_node, field, "sync_info",
+    PUSH_FIELD (input_location, object_type_node, field, "sync_info",
 		build_pointer_type (object_type_node));
   for (t = TYPE_FIELDS (object_type_node); t != NULL_TREE; t = TREE_CHAIN (t))
     FIELD_PRIVATE (t) = 1;
@@ -787,101 +815,154 @@ java_init_decl_processing (void)
   set_super_info (0, string_type_node, object_type_node, 0);
   class_ptr_type = build_pointer_type (class_type_node);
 
-  PUSH_FIELD (class_type_node, field, "next_or_version", class_ptr_type);
-  PUSH_FIELD (class_type_node, field, "name", utf8const_ptr_type);
-  PUSH_FIELD (class_type_node, field, "accflags", access_flags_type_node);
-  PUSH_FIELD (class_type_node, field, "superclass", class_ptr_type);
-  PUSH_FIELD (class_type_node, field, "constants", constants_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "next_or_version", class_ptr_type);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "name", utf8const_ptr_type);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "accflags", access_flags_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "superclass", class_ptr_type);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "constants", constants_type_node);
   constants_field_decl_node = field;
-  PUSH_FIELD (class_type_node, field, "methods", method_ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "method_count", short_type_node);
-  PUSH_FIELD (class_type_node, field, "vtable_method_count", short_type_node);
-  PUSH_FIELD (class_type_node, field, "fields", field_ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "size_in_bytes", int_type_node);
-  PUSH_FIELD (class_type_node, field, "field_count", short_type_node);
-  PUSH_FIELD (class_type_node, field, "static_field_count", short_type_node);
-  PUSH_FIELD (class_type_node, field, "vtable", dtable_ptr_type);
-  PUSH_FIELD (class_type_node, field, "otable", otable_ptr_type);
-  PUSH_FIELD (class_type_node, field, "otable_syms", 
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "methods", method_ptr_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "method_count", short_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "vtable_method_count", short_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "fields", field_ptr_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "size_in_bytes", int_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "field_count", short_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "static_field_count", short_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "vtable", dtable_ptr_type);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "otable", otable_ptr_type);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "otable_syms", 
   	      symbols_array_ptr_type);
-  PUSH_FIELD (class_type_node, field, "atable", atable_ptr_type);
-  PUSH_FIELD (class_type_node, field, "atable_syms", 
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "atable", atable_ptr_type);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "atable_syms", 
   	      symbols_array_ptr_type);
-  PUSH_FIELD (class_type_node, field, "itable", itable_ptr_type);
-  PUSH_FIELD (class_type_node, field, "itable_syms", 
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "itable", itable_ptr_type);
+  PUSH_FIELD (input_location, class_type_node, field, "itable_syms", 
   	      symbols_array_ptr_type);
-  PUSH_FIELD (class_type_node, field, "catch_classes", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "interfaces",
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "catch_classes", ptr_type_node);
+  PUSH_FIELD (input_location, class_type_node, field, "interfaces",
 	      build_pointer_type (class_ptr_type));
-  PUSH_FIELD (class_type_node, field, "loader", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "interface_count", short_type_node);
-  PUSH_FIELD (class_type_node, field, "state", byte_type_node);
-  PUSH_FIELD (class_type_node, field, "thread", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "depth", short_type_node);
-  PUSH_FIELD (class_type_node, field, "ancestors", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "idt", ptr_type_node);  
-  PUSH_FIELD (class_type_node, field, "arrayclass", ptr_type_node);  
-  PUSH_FIELD (class_type_node, field, "protectionDomain", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "assertion_table", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "hack_signers", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "chain", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "aux_info", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "engine", ptr_type_node);
-  PUSH_FIELD (class_type_node, field, "reflection_data", ptr_type_node);
+  PUSH_FIELD (input_location, class_type_node, field, "loader", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "interface_count", short_type_node);
+  PUSH_FIELD (input_location, class_type_node, field, "state", byte_type_node);
+  PUSH_FIELD (input_location, class_type_node, field, "thread", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "depth", short_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "ancestors", ptr_type_node);
+  PUSH_FIELD (input_location, class_type_node, field, "idt", ptr_type_node);  
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "arrayclass", ptr_type_node);  
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "protectionDomain", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "assertion_table", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "hack_signers", ptr_type_node);
+  PUSH_FIELD (input_location, class_type_node, field, "chain", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "aux_info", ptr_type_node);
+  PUSH_FIELD (input_location, class_type_node, field, "engine", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      class_type_node, field, "reflection_data", ptr_type_node);
   for (t = TYPE_FIELDS (class_type_node);  t != NULL_TREE;  t = TREE_CHAIN (t))
     FIELD_PRIVATE (t) = 1;
   push_super_field (class_type_node, object_type_node);
 
   FINISH_RECORD (class_type_node);
-  build_decl (TYPE_DECL, get_identifier ("Class"), class_type_node);
+  build_decl (BUILTINS_LOCATION,
+	      TYPE_DECL, get_identifier ("Class"), class_type_node);
 
   field_info_union_node = make_node (UNION_TYPE);
-  PUSH_FIELD (field_info_union_node, field, "boffset", int_type_node);
-  PUSH_FIELD (field_info_union_node, field, "addr", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      field_info_union_node, field, "boffset", int_type_node);
+  PUSH_FIELD (input_location,
+	      field_info_union_node, field, "addr", ptr_type_node);
   layout_type (field_info_union_node);
 
-  PUSH_FIELD (field_type_node, field, "name", utf8const_ptr_type);
-  PUSH_FIELD (field_type_node, field, "type", class_ptr_type);
-  PUSH_FIELD (field_type_node, field, "accflags", access_flags_type_node);
-  PUSH_FIELD (field_type_node, field, "bsize", unsigned_short_type_node);
-  PUSH_FIELD (field_type_node, field, "info", field_info_union_node);
+  PUSH_FIELD (input_location,
+	      field_type_node, field, "name", utf8const_ptr_type);
+  PUSH_FIELD (input_location, field_type_node, field, "type", class_ptr_type);
+  PUSH_FIELD (input_location,
+	      field_type_node, field, "accflags", access_flags_type_node);
+  PUSH_FIELD (input_location,
+	      field_type_node, field, "bsize", unsigned_short_type_node);
+  PUSH_FIELD (input_location,
+	      field_type_node, field, "info", field_info_union_node);
   FINISH_RECORD (field_type_node);
-  build_decl (TYPE_DECL, get_identifier ("Field"), field_type_node);
+  build_decl (BUILTINS_LOCATION,
+	      TYPE_DECL, get_identifier ("Field"), field_type_node);
 
   nativecode_ptr_array_type_node
     = build_array_type (nativecode_ptr_type_node, one_elt_array_domain_type);
 
-  PUSH_FIELD (dtable_type, field, "class", class_ptr_type);
-  PUSH_FIELD (dtable_type, field, "methods", nativecode_ptr_array_type_node);
+  PUSH_FIELD (input_location,
+	      dtable_type, field, "class", class_ptr_type);
+  PUSH_FIELD (input_location,
+	      dtable_type, field, "methods", nativecode_ptr_array_type_node);
   FINISH_RECORD (dtable_type);
-  build_decl (TYPE_DECL, get_identifier ("dispatchTable"), dtable_type);
+  build_decl (BUILTINS_LOCATION,
+	      TYPE_DECL, get_identifier ("dispatchTable"), dtable_type);
 
   jexception_type = make_node (RECORD_TYPE);
-  PUSH_FIELD (jexception_type, field, "start_pc", ptr_type_node);
-  PUSH_FIELD (jexception_type, field, "end_pc", ptr_type_node);
-  PUSH_FIELD (jexception_type, field, "handler_pc", ptr_type_node);
-  PUSH_FIELD (jexception_type, field, "catch_type", class_ptr_type);
+  PUSH_FIELD (input_location,
+	      jexception_type, field, "start_pc", ptr_type_node);
+  PUSH_FIELD (input_location, jexception_type, field, "end_pc", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      jexception_type, field, "handler_pc", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      jexception_type, field, "catch_type", class_ptr_type);
   FINISH_RECORD (jexception_type);
-  build_decl (TYPE_DECL, get_identifier ("jexception"), field_type_node);
+  build_decl (BUILTINS_LOCATION,
+	      TYPE_DECL, get_identifier ("jexception"), field_type_node);
   jexception_ptr_type = build_pointer_type (jexception_type);
 
   lineNumberEntry_type = make_node (RECORD_TYPE);
-  PUSH_FIELD (lineNumberEntry_type, field, "line_nr", unsigned_short_type_node);
-  PUSH_FIELD (lineNumberEntry_type, field, "start_pc", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      lineNumberEntry_type, field, "line_nr", unsigned_short_type_node);
+  PUSH_FIELD (input_location,
+	      lineNumberEntry_type, field, "start_pc", ptr_type_node);
   FINISH_RECORD (lineNumberEntry_type);
 
   lineNumbers_type = make_node (RECORD_TYPE);
-  PUSH_FIELD (lineNumbers_type, field, "length", unsigned_int_type_node);
+  PUSH_FIELD (input_location,
+	      lineNumbers_type, field, "length", unsigned_int_type_node);
   FINISH_RECORD (lineNumbers_type);
 
-  PUSH_FIELD (method_type_node, field, "name", utf8const_ptr_type);
-  PUSH_FIELD (method_type_node, field, "signature", utf8const_ptr_type);
-  PUSH_FIELD (method_type_node, field, "accflags", access_flags_type_node);
-  PUSH_FIELD (method_type_node, field, "index", unsigned_short_type_node);
-  PUSH_FIELD (method_type_node, field, "ncode", nativecode_ptr_type_node);
-  PUSH_FIELD (method_type_node, field, "throws", ptr_type_node);
+  PUSH_FIELD (input_location,
+	      method_type_node, field, "name", utf8const_ptr_type);
+  PUSH_FIELD (input_location,
+	      method_type_node, field, "signature", utf8const_ptr_type);
+  PUSH_FIELD (input_location,
+	      method_type_node, field, "accflags", access_flags_type_node);
+  PUSH_FIELD (input_location,
+	      method_type_node, field, "index", unsigned_short_type_node);
+  PUSH_FIELD (input_location,
+	      method_type_node, field, "ncode", nativecode_ptr_type_node);
+  PUSH_FIELD (input_location,
+	      method_type_node, field, "throws", ptr_type_node);
   FINISH_RECORD (method_type_node);
-  build_decl (TYPE_DECL, get_identifier ("Method"), method_type_node);
+  build_decl (BUILTINS_LOCATION,
+	      TYPE_DECL, get_identifier ("Method"), method_type_node);
 
   endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
 
@@ -1632,7 +1713,7 @@ give_name_to_locals (JCF *jcf)
 	{
 	  tree *ptr;
 	  int end_pc = start_pc + length;
-	  tree decl = build_decl (VAR_DECL, name, type);
+	  tree decl = build_decl (input_location, VAR_DECL, name, type);
 	  if (end_pc > DECL_CODE_LENGTH (current_function_decl))
 	    {
 	      warning (0, "bad PC range for debug info for local %q+D",
@@ -1694,7 +1775,8 @@ build_result_decl (tree fndecl)
   tree result = DECL_RESULT (fndecl);
   if (! result)
     {
-      result = build_decl (RESULT_DECL, NULL_TREE, restype);
+      result = build_decl (DECL_SOURCE_LOCATION (fndecl),
+			   RESULT_DECL, NULL_TREE, restype);
       DECL_ARTIFICIAL (result) = 1;
       DECL_IGNORED_P (result) = 1;
       DECL_CONTEXT (result) = fndecl;
@@ -1733,7 +1815,7 @@ start_java_method (tree fndecl)
       tree parm_type = TREE_VALUE (tem);
       gcc_assert (i < DECL_MAX_LOCALS (fndecl));
 
-      parm_decl = build_decl (PARM_DECL, parm_name, parm_type);
+      parm_decl = build_decl (input_location, PARM_DECL, parm_name, parm_type);
       DECL_CONTEXT (parm_decl) = fndecl;
       if (targetm.calls.promote_prototypes (parm_type)
 	  && TYPE_PRECISION (parm_type) < TYPE_PRECISION (integer_type_node)
Index: java/jcf-parse.c
===================================================================
--- java/jcf-parse.c	(revision 141983)
+++ java/jcf-parse.c	(working copy)
@@ -1703,10 +1703,11 @@ java_emit_static_constructor (void)
       tree name = get_identifier ("_Jv_global_static_constructor");
 
       tree decl 
-	= build_decl (FUNCTION_DECL, name,
+	= build_decl (input_location, FUNCTION_DECL, name,
 		      build_function_type (void_type_node, void_list_node));
 
-      tree resdecl = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
+      tree resdecl = build_decl (input_location,
+				 RESULT_DECL, NULL_TREE, void_type_node);
       DECL_ARTIFICIAL (resdecl) = 1;
       DECL_RESULT (decl) = resdecl;
       current_function_decl = decl;
@@ -1835,7 +1836,8 @@ java_parse_file (int set_yydebug ATTRIBU
 	    duplicate_class_warning (IDENTIFIER_POINTER (node));
 	  else
 	    {
-	      tree file_decl = build_decl (TRANSLATION_UNIT_DECL, node, NULL);
+	      tree file_decl = build_decl (input_location,
+					   TRANSLATION_UNIT_DECL, node, NULL);
 	      TREE_CHAIN (file_decl) = current_file_list;
 	      current_file_list = file_decl;
 	      IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
Index: java/constants.c
===================================================================
--- java/constants.c	(revision 141983)
+++ java/constants.c	(working copy)
@@ -463,7 +463,7 @@ build_constant_data_ref (bool indirect)
 	     thinks the type is incomplete.  */
 	  layout_type (type);
 
-	  decl = build_decl (VAR_DECL, decl_name, type);
+	  decl = build_decl (input_location, VAR_DECL, decl_name, type);
 	  TREE_STATIC (decl) = 1;
 	  IDENTIFIER_GLOBAL_VALUE (decl_name) = decl;
 	}
@@ -572,7 +572,8 @@ build_constants_constructor (void)
       data_value = build_address_of (data_decl);
 
       tags_type = build_array_type (unsigned_byte_type_node, index_type);
-      tags_decl = build_decl (VAR_DECL, mangled_classname ("_CT_", 
+      tags_decl = build_decl (input_location, 
+      			      VAR_DECL, mangled_classname ("_CT_", 
 							   current_class),
 			      tags_type);
       TREE_STATIC (tags_decl) = 1;
Index: java/resource.c
===================================================================
--- java/resource.c	(revision 141983)
+++ java/resource.c	(working copy)
@@ -59,9 +59,11 @@ compile_resource_data (const char *name,
   data_type = build_prim_array_type (unsigned_byte_type_node,
 				     strlen (name) + length);
   rtype = make_node (RECORD_TYPE);
-  PUSH_FIELD (rtype, field, "name_length", unsigned_int_type_node);
-  PUSH_FIELD (rtype, field, "resource_length", unsigned_int_type_node);
-  PUSH_FIELD (rtype, field, "data", data_type);
+  PUSH_FIELD (input_location,
+	      rtype, field, "name_length", unsigned_int_type_node);
+  PUSH_FIELD (input_location,
+	      rtype, field, "resource_length", unsigned_int_type_node);
+  PUSH_FIELD (input_location, rtype, field, "data", data_type);
   FINISH_RECORD (rtype);
   START_RECORD_CONSTRUCTOR (rinit, rtype);
   PUSH_FIELD_VALUE (rinit, "name_length", 
@@ -74,7 +76,8 @@ compile_resource_data (const char *name,
   FINISH_RECORD_CONSTRUCTOR (rinit);
   TREE_CONSTANT (rinit) = 1;
 
-  decl = build_decl (VAR_DECL, java_mangle_resource_name (name), rtype);
+  decl = build_decl (input_location,
+		     VAR_DECL, java_mangle_resource_name (name), rtype);
   TREE_STATIC (decl) = 1;
   TREE_PUBLIC (decl) = 1;
   java_hide_decl (decl);
@@ -100,7 +103,8 @@ write_resource_constructor (tree *list_p
     return;
 
   t = build_function_type_list (void_type_node, ptr_type_node, NULL);
-  t = build_decl (FUNCTION_DECL, get_identifier ("_Jv_RegisterResource"), t);
+  t = build_decl (input_location,
+		  FUNCTION_DECL, get_identifier ("_Jv_RegisterResource"), t);
   TREE_PUBLIC (t) = 1;
   DECL_EXTERNAL (t) = 1;
   register_resource_fn = t;
Index: java/except.c
===================================================================
--- java/except.c	(revision 141983)
+++ java/except.c	(working copy)
@@ -393,7 +393,8 @@ prepare_eh_table_type (tree type)
       name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
       buf = (char *) alloca (strlen (name) + 5);
       sprintf (buf, "%s_ref", name);
-      decl = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node);
+      decl = build_decl (input_location,
+			 VAR_DECL, get_identifier (buf), ptr_type_node);
       TREE_STATIC (decl) = 1;
       DECL_ARTIFICIAL (decl) = 1;
       DECL_IGNORED_P (decl) = 1;
@@ -410,7 +411,8 @@ prepare_eh_table_type (tree type)
       name = IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (utf8_ref, 0)));
       buf = (char *) alloca (strlen (name) + 5);
       sprintf (buf, "%s_ref", name);
-      decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_ptr_type);
+      decl = build_decl (input_location,
+			 VAR_DECL, get_identifier (buf), utf8const_ptr_type);
       TREE_STATIC (decl) = 1;
       DECL_ARTIFICIAL (decl) = 1;
       DECL_IGNORED_P (decl) = 1;
Index: java/builtins.c
===================================================================
--- java/builtins.c	(revision 141983)
+++ java/builtins.c	(working copy)
@@ -399,7 +399,7 @@ getVolatile_builtin (tree method_return_
   
   stmt = build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0);
   
-  tmp = build_decl (VAR_DECL, NULL, method_return_type);
+  tmp = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL, method_return_type);
   DECL_IGNORED_P (tmp) = 1;
   DECL_ARTIFICIAL (tmp) = 1;
   pushdecl (tmp);
@@ -442,7 +442,8 @@ define_builtin (enum built_in_function v
 {
   tree decl;
 
-  decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
+  decl = build_decl (BUILTINS_LOCATION,
+		     FUNCTION_DECL, get_identifier (name), type);
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 1;
   SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
Index: java/expr.c
===================================================================
--- java/expr.c	(revision 141983)
+++ java/expr.c	(working copy)
@@ -669,7 +669,7 @@ java_stack_swap (void)
   flush_quick_stack ();
   decl1 = find_stack_slot (stack_pointer - 1, type1);
   decl2 = find_stack_slot (stack_pointer - 2, type2);
-  temp = build_decl (VAR_DECL, NULL_TREE, type1);
+  temp = build_decl (input_location, VAR_DECL, NULL_TREE, type1);
   java_add_local_var (temp);
   java_add_stmt (build2 (MODIFY_EXPR, type1, temp, decl1));
   java_add_stmt (build2 (MODIFY_EXPR, type2, 
@@ -1192,7 +1192,7 @@ expand_java_arraystore (tree rhs_type_no
      MODIFY_EXPR to set the array element.  */
 
   access = build_java_arrayaccess (array, rhs_type_node, index);
-  temp = build_decl (VAR_DECL, NULL_TREE, 
+  temp = build_decl (input_location, VAR_DECL, NULL_TREE, 
 		     build_pointer_type (TREE_TYPE (access)));
   java_add_local_var (temp);
   java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (temp),
@@ -1332,7 +1332,7 @@ expand_load_internal (int index, tree ty
      generated.  To avoid this we create a new local and copy our
      value into it.  Then we push this new local on the stack.
      Hopefully this all gets optimized out.  */
-  copy = build_decl (VAR_DECL, NULL_TREE, type);
+  copy = build_decl (input_location, VAR_DECL, NULL_TREE, type);
   if ((INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))
       && TREE_TYPE (copy) != TREE_TYPE (var))
     var = convert (type, var);
@@ -1824,7 +1824,7 @@ tree
 create_label_decl (tree name)
 {
   tree decl;
-  decl = build_decl (LABEL_DECL, name, 
+  decl = build_decl (input_location, LABEL_DECL, name, 
 		     TREE_TYPE (return_address_type_node));
   DECL_CONTEXT (decl) = current_function_decl;
   DECL_IGNORED_P (decl) = 1;
@@ -1907,7 +1907,7 @@ expand_java_switch (tree selector, int d
   java_add_stmt (switch_expr);
 
   x = build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE,
-	      create_artificial_label ());
+	      create_artificial_label (input_location));
   append_to_statement_list (x, &SWITCH_BODY (switch_expr));
 
   x = build1 (GOTO_EXPR, void_type_node, lookup_label (default_pc));
@@ -1924,7 +1924,7 @@ expand_java_add_case (tree switch_expr, 
   value = build_int_cst (TREE_TYPE (switch_expr), match);
   
   x = build3 (CASE_LABEL_EXPR, void_type_node, value, NULL_TREE,
-	      create_artificial_label ());
+	      create_artificial_label (input_location));
   append_to_statement_list (x, &SWITCH_BODY (switch_expr));
 
   x = build1 (GOTO_EXPR, void_type_node, lookup_label (target_pc));
@@ -2026,7 +2026,7 @@ build_class_init (tree clas, tree expr)
 	{
 	  /* Build a declaration and mark it as a flag used to track
 	     static class initializations. */
-	  decl = build_decl (VAR_DECL, NULL_TREE,
+	  decl = build_decl (input_location, VAR_DECL, NULL_TREE,
 			     boolean_type_node);
 	  MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
 	  DECL_CONTEXT (decl) = current_function_decl;
@@ -2666,12 +2666,13 @@ build_jni_stub (tree method)
   DECL_ARTIFICIAL (method) = 1;
   DECL_EXTERNAL (method) = 0;
 
-  env_var = build_decl (VAR_DECL, get_identifier ("env"), ptr_type_node);
+  env_var = build_decl (input_location,
+			VAR_DECL, get_identifier ("env"), ptr_type_node);
   DECL_CONTEXT (env_var) = method;
 
   if (TREE_TYPE (TREE_TYPE (method)) != void_type_node)
     {
-      res_var = build_decl (VAR_DECL, get_identifier ("res"),
+      res_var = build_decl (input_location, VAR_DECL, get_identifier ("res"),
 			    TREE_TYPE (TREE_TYPE (method)));
       DECL_CONTEXT (res_var) = method;
       TREE_CHAIN (env_var) = res_var;
@@ -2745,7 +2746,8 @@ build_jni_stub (tree method)
      garbage-collected.  If it is, we end up using canonical types
      with different uids for equivalent function types, and this in
      turn causes utf8 identifiers and output order to vary.  */
-  meth_var = build_decl (VAR_DECL, get_identifier ("meth"), jni_func_type);
+  meth_var = build_decl (input_location,
+			 VAR_DECL, get_identifier ("meth"), jni_func_type);
   TREE_STATIC (meth_var) = 1;
   TREE_PUBLIC (meth_var) = 0;
   DECL_EXTERNAL (meth_var) = 0;
@@ -2971,7 +2973,8 @@ expand_java_field_op (int is_static, int
     }
   else
     {
-      tree temp = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (field_ref));
+      tree temp = build_decl (input_location,
+			      VAR_DECL, NULL_TREE, TREE_TYPE (field_ref));
       java_add_local_var (temp);
 
       if (TREE_THIS_VOLATILE (field_decl))
@@ -3832,7 +3835,7 @@ cache_cpool_data_ref (void)
     {
       tree cpool;
       tree d = build_constant_data_ref (flag_indirect_classes);
-      tree cpool_ptr = build_decl (VAR_DECL, NULL_TREE, 
+      tree cpool_ptr = build_decl (input_location, VAR_DECL, NULL_TREE, 
 				   build_pointer_type (TREE_TYPE (d)));
       java_add_local_var (cpool_ptr);
       TREE_CONSTANT (cpool_ptr) = 1;
Index: java/java-tree.h
===================================================================
--- java/java-tree.h	(revision 141983)
+++ java/java-tree.h	(working copy)
@@ -1443,15 +1443,15 @@ extern tree *type_map;
 #define DECL_INNER_CLASS_LIST(NODE) DECL_INITIAL (TYPE_DECL_CHECK (NODE))
 
 /* Add a FIELD_DECL to RECORD_TYPE RTYPE.
-   The field has name NAME (a char*), and type FTYPE.
+   The field has name NAME (a char*), a type FTYPE, and a location of LOC.
    Unless this is the first field, FIELD most hold the previous field.
    FIELD is set to the newly created FIELD_DECL.
 
    We set DECL_ARTIFICIAL so these fields get skipped by make_class_data
    if compiling java.lang.Object or java.lang.Class. */
 
-#define PUSH_FIELD(RTYPE, FIELD, NAME, FTYPE) \
-{ tree _field = build_decl (FIELD_DECL, get_identifier ((NAME)), (FTYPE)); \
+#define PUSH_FIELD(LOC, RTYPE, FIELD, NAME, FTYPE) \
+{ tree _field = build_decl (LOC, FIELD_DECL, get_identifier ((NAME)), (FTYPE)); \
   if (TYPE_FIELDS (RTYPE) == NULL_TREE)	\
     TYPE_FIELDS (RTYPE) = _field; 	\
   else					\
Index: optabs.c
===================================================================
--- optabs.c	(revision 141983)
+++ optabs.c	(working copy)
@@ -6057,7 +6057,8 @@ init_one_libfunc (const char *name)
 	 targetm.encode_section_info.  */
       /* ??? We don't have any type information except for this is
 	 a function.  Pretend this is "int foo()".  */
-      decl = build_decl (FUNCTION_DECL, get_identifier (name),
+      decl = build_decl (UNKNOWN_LOCATION,
+			 FUNCTION_DECL, get_identifier (name),
 			 build_function_type (integer_type_node, NULL_TREE));
       DECL_ARTIFICIAL (decl) = 1;
       DECL_EXTERNAL (decl) = 1;
Index: tree.c
===================================================================
--- tree.c	(revision 141983)
+++ tree.c	(working copy)
@@ -3493,15 +3493,19 @@ build_nt_call_list (tree fn, tree arglis
 /* Create a DECL_... node of code CODE, name NAME and data type TYPE.
    We do NOT enter this node in any sort of symbol table.
 
+   LOC is the location of the decl.
+
    layout_decl is used to set up the decl's storage layout.
    Other slots are initialized to 0 or null pointers.  */
 
 tree
-build_decl_stat (enum tree_code code, tree name, tree type MEM_STAT_DECL)
+build_decl_stat (location_t loc, enum tree_code code, tree name,
+    		 tree type MEM_STAT_DECL)
 {
   tree t;
 
   t = make_node_stat (code PASS_MEM_STAT);
+  DECL_SOURCE_LOCATION (t) = loc;
 
 /*  if (type == error_mark_node)
     type = integer_type_node; */
@@ -3523,7 +3527,7 @@ tree
 build_fn_decl (const char *name, tree type)
 {
   tree id = get_identifier (name);
-  tree decl = build_decl (FUNCTION_DECL, id, type);
+  tree decl = build_decl (input_location, FUNCTION_DECL, id, type);
 
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 1;
@@ -6250,7 +6254,8 @@ build_complex_type (tree component_type)
 	name = 0;
 
       if (name != 0)
-	TYPE_NAME (t) = build_decl (TYPE_DECL, get_identifier (name), t);
+	TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
+	    			    get_identifier (name), t);
     }
 
   return build_qualified_type (t, TYPE_QUALS (component_type));
@@ -7309,7 +7314,8 @@ make_vector_type (tree innertype, int nu
     tree array = build_array_type (innertype, build_index_type (index));
     tree rt = make_node (RECORD_TYPE);
 
-    TYPE_FIELDS (rt) = build_decl (FIELD_DECL, get_identifier ("f"), array);
+    TYPE_FIELDS (rt) = build_decl (UNKNOWN_LOCATION, FIELD_DECL,
+				   get_identifier ("f"), array);
     DECL_CONTEXT (TYPE_FIELDS (rt)) = rt;
     layout_type (rt);
     TYPE_DEBUG_REPRESENTATION_TYPE (t) = rt;
@@ -8937,13 +8943,15 @@ call_expr_arglist (tree exp)
 }
 
 
-/* Create a nameless artificial label and put it in the current function
-   context.  Returns the newly created label.  */
+/* Create a nameless artificial label and put it in the current
+   function context.  The label has a location of LOC.  Returns the
+   newly created label.  */
 
 tree
-create_artificial_label (void)
+create_artificial_label (location_t loc)
 {
-  tree lab = build_decl (LABEL_DECL, NULL_TREE, void_type_node);
+  tree lab = build_decl (loc,
+      			 LABEL_DECL, NULL_TREE, void_type_node);
 
   DECL_ARTIFICIAL (lab) = 1;
   DECL_IGNORED_P (lab) = 1;
Index: tree.h
===================================================================
--- tree.h	(revision 141983)
+++ tree.h	(working copy)
@@ -3960,9 +3960,9 @@ extern tree build_one_cst (tree);
 extern tree build_string (int, const char *);
 extern tree build_tree_list_stat (tree, tree MEM_STAT_DECL);
 #define build_tree_list(t,q) build_tree_list_stat(t,q MEM_STAT_INFO)
-extern tree build_decl_stat (enum tree_code, tree, tree MEM_STAT_DECL);
+extern tree build_decl_stat (location_t, enum tree_code, tree, tree MEM_STAT_DECL);
 extern tree build_fn_decl (const char *, tree);
-#define build_decl(c,t,q) build_decl_stat (c,t,q MEM_STAT_INFO)
+#define build_decl(l,c,t,q) build_decl_stat (l,c,t,q MEM_STAT_INFO)
 extern tree build_block (tree, tree, tree, tree);
 extern tree build_empty_stmt (void);
 extern tree build_omp_clause (enum omp_clause_code);
@@ -4683,7 +4683,7 @@ extern int operand_equal_for_phi_arg_p (
 extern tree call_expr_arg (tree, int);
 extern tree *call_expr_argp (tree, int);
 extern tree call_expr_arglist (tree);
-extern tree create_artificial_label (void);
+extern tree create_artificial_label (location_t);
 extern const char *get_name (tree);
 extern bool stdarg_p (tree);
 extern bool prototype_p (tree);
Index: target.h
===================================================================
--- target.h	(revision 141983)
+++ target.h	(working copy)
@@ -554,7 +554,7 @@ struct gcc_target
      *before* regular type checking, and so allows the target to implement
      a crude form of function overloading.  The result is a complete
      expression that implements the operation.  */
-  tree (*resolve_overloaded_builtin) (tree decl, tree params);
+  tree (*resolve_overloaded_builtin) (unsigned int /*location_t*/, tree decl, tree params);
 
   /* Fold a target-specific builtin.  */
   tree (* fold_builtin) (tree fndecl, tree arglist, bool ignore);
Index: builtins.c
===================================================================
--- builtins.c	(revision 141983)
+++ builtins.c	(working copy)
@@ -5921,7 +5921,8 @@ expand_builtin_fork_or_exec (tree fn, tr
       gcc_unreachable ();
     }
 
-  decl = build_decl (FUNCTION_DECL, id, TREE_TYPE (fn));
+  decl = build_decl (DECL_SOURCE_LOCATION (fn),
+		     FUNCTION_DECL, id, TREE_TYPE (fn));
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
Index: omp-low.c
===================================================================
--- omp-low.c	(revision 141983)
+++ omp-low.c	(working copy)
@@ -807,7 +807,7 @@ use_pointer_for_field (tree decl, omp_co
 tree
 copy_var_decl (tree var, tree name, tree type)
 {
-  tree copy = build_decl (VAR_DECL, name, type);
+  tree copy = build_decl (DECL_SOURCE_LOCATION (var), VAR_DECL, name, type);
 
   TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (var);
   TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (var);
@@ -816,7 +816,6 @@ copy_var_decl (tree var, tree name, tree
   DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (var);
   DECL_IGNORED_P (copy) = DECL_IGNORED_P (var);
   DECL_CONTEXT (copy) = DECL_CONTEXT (var);
-  DECL_SOURCE_LOCATION (copy) = DECL_SOURCE_LOCATION (var);
   TREE_USED (copy) = 1;
   DECL_SEEN_IN_BIND_EXPR_P (copy) = 1;
 
@@ -929,7 +928,8 @@ install_var_field (tree var, bool by_ref
   else if ((mask & 3) == 1 && is_reference (var))
     type = TREE_TYPE (type);
 
-  field = build_decl (FIELD_DECL, DECL_NAME (var), type);
+  field = build_decl (DECL_SOURCE_LOCATION (var),
+		      FIELD_DECL, DECL_NAME (var), type);
 
   /* Remember what variable this field was created for.  This does have a
      side effect of making dwarf2out ignore this member, so for helpful
@@ -949,7 +949,8 @@ install_var_field (tree var, bool by_ref
       insert_field_into_struct (ctx->record_type, field);
       if (ctx->srecord_type)
 	{
-	  sfield = build_decl (FIELD_DECL, DECL_NAME (var), type);
+	  sfield = build_decl (DECL_SOURCE_LOCATION (var),
+			       FIELD_DECL, DECL_NAME (var), type);
 	  DECL_ABSTRACT_ORIGIN (sfield) = var;
 	  DECL_ALIGN (sfield) = DECL_ALIGN (field);
 	  DECL_USER_ALIGN (sfield) = DECL_USER_ALIGN (field);
@@ -967,7 +968,8 @@ install_var_field (tree var, bool by_ref
 	  ctx->sfield_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
 	  for (t = TYPE_FIELDS (ctx->record_type); t ; t = TREE_CHAIN (t))
 	    {
-	      sfield = build_decl (FIELD_DECL, DECL_NAME (t), TREE_TYPE (t));
+	      sfield = build_decl (DECL_SOURCE_LOCATION (var),
+				   FIELD_DECL, DECL_NAME (t), TREE_TYPE (t));
 	      DECL_ABSTRACT_ORIGIN (sfield) = DECL_ABSTRACT_ORIGIN (t);
 	      insert_field_into_struct (ctx->srecord_type, sfield);
 	      splay_tree_insert (ctx->sfield_map,
@@ -1044,7 +1046,7 @@ omp_copy_decl (tree var, copy_body_data 
 
   if (TREE_CODE (var) == LABEL_DECL)
     {
-      new_var = create_artificial_label ();
+      new_var = create_artificial_label (DECL_SOURCE_LOCATION (var));
       DECL_CONTEXT (new_var) = current_function_decl;
       insert_decl_map (&ctx->cb, var, new_var);
       return new_var;
@@ -1310,7 +1312,8 @@ fixup_child_record_type (omp_context *ct
 
       type = lang_hooks.types.make_type (RECORD_TYPE);
       name = DECL_NAME (TYPE_NAME (ctx->record_type));
-      name = build_decl (TYPE_DECL, name, type);
+      name = build_decl (DECL_SOURCE_LOCATION (ctx->receiver_decl),
+			 TYPE_DECL, name, type);
       TYPE_NAME (type) = name;
 
       for (f = TYPE_FIELDS (ctx->record_type); f ; f = TREE_CHAIN (f))
@@ -1556,7 +1559,8 @@ create_omp_child_function (omp_context *
   else
     type = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
 
-  decl = build_decl (FUNCTION_DECL, name, type);
+  decl = build_decl (gimple_location (ctx->stmt),
+		     FUNCTION_DECL, name, type);
   decl = lang_hooks.decls.pushdecl (decl);
 
   if (!task_copy)
@@ -1574,12 +1578,14 @@ create_omp_child_function (omp_context *
   DECL_CONTEXT (decl) = NULL_TREE;
   DECL_INITIAL (decl) = make_node (BLOCK);
 
-  t = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
+  t = build_decl (DECL_SOURCE_LOCATION (decl),
+		  RESULT_DECL, NULL_TREE, void_type_node);
   DECL_ARTIFICIAL (t) = 1;
   DECL_IGNORED_P (t) = 1;
   DECL_RESULT (decl) = t;
 
-  t = build_decl (PARM_DECL, get_identifier (".omp_data_i"), ptr_type_node);
+  t = build_decl (DECL_SOURCE_LOCATION (decl),
+		  PARM_DECL, get_identifier (".omp_data_i"), ptr_type_node);
   DECL_ARTIFICIAL (t) = 1;
   DECL_ARG_TYPE (t) = ptr_type_node;
   DECL_CONTEXT (t) = current_function_decl;
@@ -1589,7 +1595,8 @@ create_omp_child_function (omp_context *
     ctx->receiver_decl = t;
   else
     {
-      t = build_decl (PARM_DECL, get_identifier (".omp_data_o"),
+      t = build_decl (DECL_SOURCE_LOCATION (decl),
+		      PARM_DECL, get_identifier (".omp_data_o"),
 		      ptr_type_node);
       DECL_ARTIFICIAL (t) = 1;
       DECL_ARG_TYPE (t) = ptr_type_node;
@@ -1603,7 +1610,6 @@ create_omp_child_function (omp_context *
      allocate_struct_function clobbers CFUN, so we need to restore
      it afterward.  */
   push_struct_function (decl);
-  DECL_SOURCE_LOCATION (decl) = gimple_location (ctx->stmt);
   cfun->function_end_locus = gimple_location (ctx->stmt);
   pop_cfun ();
 }
@@ -1636,7 +1642,8 @@ scan_omp_parallel (gimple_stmt_iterator 
   ctx->default_kind = OMP_CLAUSE_DEFAULT_SHARED;
   ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE);
   name = create_tmp_var_name (".omp_data_s");
-  name = build_decl (TYPE_DECL, name, ctx->record_type);
+  name = build_decl (gimple_location (stmt),
+		     TYPE_DECL, name, ctx->record_type);
   TYPE_NAME (ctx->record_type) = name;
   create_omp_child_function (ctx, false);
   gimple_omp_parallel_set_child_fn (stmt, ctx->cb.dst_fn);
@@ -1677,7 +1684,8 @@ scan_omp_task (gimple_stmt_iterator *gsi
   ctx->default_kind = OMP_CLAUSE_DEFAULT_SHARED;
   ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE);
   name = create_tmp_var_name (".omp_data_s");
-  name = build_decl (TYPE_DECL, name, ctx->record_type);
+  name = build_decl (gimple_location (stmt),
+		     TYPE_DECL, name, ctx->record_type);
   TYPE_NAME (ctx->record_type) = name;
   create_omp_child_function (ctx, false);
   gimple_omp_task_set_child_fn (stmt, ctx->cb.dst_fn);
@@ -1687,7 +1695,8 @@ scan_omp_task (gimple_stmt_iterator *gsi
   if (ctx->srecord_type)
     {
       name = create_tmp_var_name (".omp_data_a");
-      name = build_decl (TYPE_DECL, name, ctx->srecord_type);
+      name = build_decl (gimple_location (stmt),
+			 TYPE_DECL, name, ctx->srecord_type);
       TYPE_NAME (ctx->srecord_type) = name;
       create_omp_child_function (ctx, true);
     }
@@ -1780,7 +1789,8 @@ scan_omp_single (gimple stmt, omp_contex
   ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
   ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE);
   name = create_tmp_var_name (".omp_copy_s");
-  name = build_decl (TYPE_DECL, name, ctx->record_type);
+  name = build_decl (gimple_location (stmt),
+		     TYPE_DECL, name, ctx->record_type);
   TYPE_NAME (ctx->record_type) = name;
 
   scan_sharing_clauses (gimple_omp_single_clauses (stmt), ctx);
@@ -2512,8 +2522,8 @@ lower_lastprivate_clauses (tree clauses,
       gimple stmt;
       tree label_true, arm1, arm2;
 
-      label = create_artificial_label ();
-      label_true = create_artificial_label ();
+      label = create_artificial_label (UNKNOWN_LOCATION);
+      label_true = create_artificial_label (UNKNOWN_LOCATION);
       arm1 = TREE_OPERAND (predicate, 0);
       arm2 = TREE_OPERAND (predicate, 1);
       gimplify_expr (&arm1, stmt_list, NULL, is_gimple_val, fb_rvalue);
@@ -5520,8 +5530,9 @@ lower_omp_sections (gimple_stmt_iterator
 static void
 lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p)
 {
-  tree tlabel = create_artificial_label ();
-  tree flabel = create_artificial_label ();
+  location_t loc = gimple_location (single_stmt);
+  tree tlabel = create_artificial_label (loc);
+  tree flabel = create_artificial_label (loc);
   gimple call, cond;
   tree lhs, decl;
 
@@ -5575,15 +5586,16 @@ lower_omp_single_copy (gimple single_stm
 {
   tree ptr_type, t, l0, l1, l2;
   gimple_seq copyin_seq;
+  location_t loc = gimple_location (single_stmt);
 
   ctx->sender_decl = create_tmp_var (ctx->record_type, ".omp_copy_o");
 
   ptr_type = build_pointer_type (ctx->record_type);
   ctx->receiver_decl = create_tmp_var (ptr_type, ".omp_copy_i");
 
-  l0 = create_artificial_label ();
-  l1 = create_artificial_label ();
-  l2 = create_artificial_label ();
+  l0 = create_artificial_label (loc);
+  l1 = create_artificial_label (loc);
+  l2 = create_artificial_label (loc);
 
   t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_START], 0);
   t = fold_convert (ptr_type, t);
@@ -6031,7 +6043,8 @@ task_copyfn_remap_type (struct omp_taskc
 
   type = lang_hooks.types.make_type (RECORD_TYPE);
   name = DECL_NAME (TYPE_NAME (orig_type));
-  name = build_decl (TYPE_DECL, name, type);
+  name = build_decl (gimple_location (tcctx->ctx->stmt),
+		     TYPE_DECL, name, type);
   TYPE_NAME (type) = name;
 
   for (f = TYPE_FIELDS (orig_type); f ; f = TREE_CHAIN (f))
Index: objc/objc-act.c
===================================================================
--- objc/objc-act.c	(revision 141983)
+++ objc/objc-act.c	(working copy)
@@ -432,7 +432,7 @@ generate_struct_by_value_array (void)
       char buffer[5];
 
       /* Create an unnamed struct that has `i' character components */
-      type = start_struct (RECORD_TYPE, NULL_TREE);
+      type = start_struct (input_location, RECORD_TYPE, NULL_TREE);
 
       strcpy (buffer, "c1");
       field_decl = create_field_decl (char_type_node,
@@ -446,7 +446,7 @@ generate_struct_by_value_array (void)
 					  buffer);
 	  chainon (field_decl_chain, field_decl);
 	}
-      finish_struct (type, field_decl_chain, NULL_TREE);
+      finish_struct (input_location, type, field_decl_chain, NULL_TREE);
 
       aggregate_in_mem[i] = aggregate_value_p (type, 0);
       if (!aggregate_in_mem[i])
@@ -786,7 +786,7 @@ static tree
 objc_build_struct (tree klass, tree fields, tree super_name)
 {
   tree name = CLASS_NAME (klass);
-  tree s = start_struct (RECORD_TYPE, name);
+  tree s = start_struct (input_location, RECORD_TYPE, name);
   tree super = (super_name ? xref_tag (RECORD_TYPE, super_name) : NULL_TREE);
   tree t, objc_info = NULL_TREE;
 
@@ -794,7 +794,8 @@ objc_build_struct (tree klass, tree fiel
     {
       /* Prepend a packed variant of the base class into the layout.  This
 	 is necessary to preserve ObjC ABI compatibility.  */
-      tree base = build_decl (FIELD_DECL, NULL_TREE, super);
+      tree base = build_decl (input_location,
+			      FIELD_DECL, NULL_TREE, super);
       tree field = TYPE_FIELDS (super);
 
       while (field && TREE_CHAIN (field)
@@ -847,7 +848,7 @@ objc_build_struct (tree klass, tree fiel
   INIT_TYPE_OBJC_INFO (s);
   TYPE_OBJC_INTERFACE (s) = klass;
 
-  s = finish_struct (s, fields, NULL_TREE);
+  s = finish_struct (input_location, s, fields, NULL_TREE);
 
   for (t = TYPE_NEXT_VARIANT (s); t;
        t = TYPE_NEXT_VARIANT (t), objc_info = TREE_CHAIN (objc_info))
@@ -1450,7 +1451,8 @@ lookup_and_install_protocols (tree proto
 static tree
 create_field_decl (tree type, const char *name)
 {
-  return build_decl (FIELD_DECL, get_identifier (name), type);
+  return build_decl (input_location,
+		     FIELD_DECL, get_identifier (name), type);
 }
 
 /* Create a global, static declaration for variable NAME of a given TYPE.  The
@@ -1459,7 +1461,8 @@ create_field_decl (tree type, const char
 static tree
 start_var_decl (tree type, const char *name)
 {
-  tree var = build_decl (VAR_DECL, get_identifier (name), type);
+  tree var = build_decl (input_location,
+			 VAR_DECL, get_identifier (name), type);
 
   TREE_STATIC (var) = 1;
   DECL_INITIAL (var) = error_mark_node;  /* A real initializer is coming... */
@@ -1549,11 +1552,13 @@ synth_module_prologue (void)
 
   /* Declare the 'id' and 'Class' typedefs.  */
 
-  type = lang_hooks.decls.pushdecl (build_decl (TYPE_DECL,
+  type = lang_hooks.decls.pushdecl (build_decl (input_location,
+						TYPE_DECL,
 						objc_object_name,
 						objc_object_type));
   TREE_NO_WARNING (type) = 1;
-  type = lang_hooks.decls.pushdecl (build_decl (TYPE_DECL,
+  type = lang_hooks.decls.pushdecl (build_decl (input_location,
+						TYPE_DECL,
 						objc_class_name,
 						objc_class_type));
   TREE_NO_WARNING (type) = 1;
@@ -1811,11 +1816,14 @@ static tree
 objc_build_internal_const_str_type (void)
 {
   tree type = (*lang_hooks.types.make_type) (RECORD_TYPE);
-  tree fields = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node);
-  tree field = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node);
+  tree fields = build_decl (input_location,
+			    FIELD_DECL, NULL_TREE, ptr_type_node);
+  tree field = build_decl (input_location,
+			   FIELD_DECL, NULL_TREE, ptr_type_node);
 
   TREE_CHAIN (field) = fields; fields = field;
-  field = build_decl (FIELD_DECL, NULL_TREE, unsigned_type_node);
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, unsigned_type_node);
   TREE_CHAIN (field) = fields; fields = field;
   /* NB: The finish_builtin_struct() routine expects FIELD_DECLs in
      reverse order!  */
@@ -1958,7 +1966,8 @@ objc_build_string_object (tree string)
 	  = objc_add_static_instance (constructor, constant_string_type);
       else
         {
-	  var = build_decl (CONST_DECL, NULL, TREE_TYPE (constructor));
+	  var = build_decl (input_location,
+			    CONST_DECL, NULL, TREE_TYPE (constructor));
 	  DECL_INITIAL (var) = constructor;
 	  TREE_STATIC (var) = 1;
 	  pushdecl_top_level (var);
@@ -1996,7 +2005,8 @@ objc_add_static_instance (tree construct
     }
 
   sprintf (buf, "_OBJC_INSTANCE_%d", num_static_inst++);
-  decl = build_decl (VAR_DECL, get_identifier (buf), class_decl);
+  decl = build_decl (input_location,
+		     VAR_DECL, get_identifier (buf), class_decl);
   DECL_COMMON (decl) = 1;
   TREE_STATIC (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
@@ -2056,7 +2066,7 @@ build_objc_symtab_template (void)
   tree field_decl, field_decl_chain;
 
   objc_symtab_template
-    = start_struct (RECORD_TYPE, get_identifier (UTAG_SYMTAB));
+    = start_struct (input_location, RECORD_TYPE, get_identifier (UTAG_SYMTAB));
 
   /* long sel_ref_cnt; */
   field_decl = create_field_decl (long_integer_type_node, "sel_ref_cnt");
@@ -2090,7 +2100,8 @@ build_objc_symtab_template (void)
       chainon (field_decl_chain, field_decl);
     }
 
-  finish_struct (objc_symtab_template, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 objc_symtab_template, field_decl_chain, NULL_TREE);
 }
 
 /* Create the initial value for the `defs' field of _objc_symtab.
@@ -2291,7 +2302,7 @@ build_module_descriptor (void)
 #endif
 
   objc_module_template
-    = start_struct (RECORD_TYPE, get_identifier (UTAG_MODULE));
+    = start_struct (input_location, RECORD_TYPE, get_identifier (UTAG_MODULE));
 
   /* long version; */
   field_decl = create_field_decl (long_integer_type_node, "version");
@@ -2313,7 +2324,8 @@ build_module_descriptor (void)
 			 "symtab");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_module_template, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 objc_module_template, field_decl_chain, NULL_TREE);
 
   /* Create an instance of "_objc_module".  */
   UOBJC_MODULES_decl = start_var_decl (objc_module_template, "_OBJC_MODULES");
@@ -2341,7 +2353,8 @@ build_module_initializer_routine (void)
   push_lang_context (lang_name_c); /* extern "C" */
 #endif
 
-  objc_push_parm (build_decl (PARM_DECL, NULL_TREE, void_type_node));
+  objc_push_parm (build_decl (input_location,
+			      PARM_DECL, NULL_TREE, void_type_node));
   objc_start_function (get_identifier (TAG_GNUINIT),
 		       build_function_type (void_type_node,
 					    OBJC_VOID_AT_END),
@@ -2349,7 +2362,8 @@ build_module_initializer_routine (void)
 
   body = c_begin_compound_stmt (true);
   add_stmt (build_function_call
-	    (execclass_decl,
+	    (input_location,
+	     execclass_decl,
 	     build_tree_list
 	     (NULL_TREE,
 	      build_unary_op (input_location, ADDR_EXPR,
@@ -2388,7 +2402,8 @@ tree
 objc_generate_static_init_call (tree ctors ATTRIBUTE_UNUSED)
 {
   add_stmt (build_stmt (EXPR_STMT,
-			build_function_call (GNU_INIT_decl, NULL_TREE)));
+			build_function_call (input_location,
+					     GNU_INIT_decl, NULL_TREE)));
 
   return ctors;
 }
@@ -2786,7 +2801,7 @@ objc_get_class_reference (tree ident)
 				 IDENTIFIER_POINTER (ident)));
 
       assemble_external (objc_get_class_decl);
-      return build_function_call (objc_get_class_decl, params);
+      return build_function_call (input_location, objc_get_class_decl, params);
     }
 }
 
@@ -2854,7 +2869,8 @@ build_objc_string_decl (enum string_sect
 
   ident = get_identifier (buf);
 
-  decl = build_decl (VAR_DECL, ident, build_array_type (char_type_node, 0));
+  decl = build_decl (input_location,
+		     VAR_DECL, ident, build_array_type (char_type_node, 0));
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 0;
   TREE_USED (decl) = 1;
@@ -2894,7 +2910,8 @@ objc_declare_alias (tree alias_ident, tr
       push_lang_context (lang_name_c); /* extern "C" */
 #endif
       lang_hooks.decls.pushdecl (build_decl
-				 (TYPE_DECL,
+				 (input_location,
+				  TYPE_DECL,
 				  alias_ident,
 				  xref_tag (RECORD_TYPE, underlying_class)));
 #ifdef OBJCPLUS
@@ -3099,7 +3116,7 @@ objc_build_ivar_assignment (tree outerva
 		    NULL_TREE)));
 
   assemble_external (func);
-  return build_function_call (func, func_params);
+  return build_function_call (input_location, func, func_params);
 }
 
 static tree
@@ -3112,7 +3129,8 @@ objc_build_global_assignment (tree lhs, 
 		    NULL_TREE));
 
   assemble_external (objc_assign_global_decl);
-  return build_function_call (objc_assign_global_decl, func_params);
+  return build_function_call (input_location, 
+			      objc_assign_global_decl, func_params);
 }
 
 static tree
@@ -3125,7 +3143,8 @@ objc_build_strong_cast_assignment (tree 
 		    NULL_TREE));
 
   assemble_external (objc_assign_strong_cast_decl);
-  return build_function_call (objc_assign_strong_cast_decl, func_params);
+  return build_function_call (input_location,
+			      objc_assign_strong_cast_decl, func_params);
 }
 
 static int
@@ -3393,7 +3412,8 @@ objc_create_temporary_var (tree type)
 {
   tree decl;
 
-  decl = build_decl (VAR_DECL, NULL_TREE, type);
+  decl = build_decl (input_location,
+		     VAR_DECL, NULL_TREE, type);
   TREE_USED (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
   DECL_IGNORED_P (decl) = 1;
@@ -3513,7 +3533,8 @@ next_sjlj_build_try_exit (void)
   tree t;
   t = build_fold_addr_expr (cur_try_context->stack_decl);
   t = tree_cons (NULL, t, NULL);
-  t = build_function_call (objc_exception_try_exit_decl, t);
+  t = build_function_call (input_location,
+			   objc_exception_try_exit_decl, t);
   return t;
 }
 
@@ -3533,7 +3554,8 @@ next_sjlj_build_enter_and_setjmp (void)
 
   t = build_fold_addr_expr (cur_try_context->stack_decl);
   t = tree_cons (NULL, t, NULL);
-  enter = build_function_call (objc_exception_try_enter_decl, t);
+  enter = build_function_call (input_location,
+			       objc_exception_try_enter_decl, t);
 
   t = objc_build_component_ref (cur_try_context->stack_decl,
 				get_identifier ("buf"));
@@ -3548,7 +3570,8 @@ next_sjlj_build_enter_and_setjmp (void)
   t = convert (ptr_type_node, t);
 #endif
   t = tree_cons (NULL, t, NULL);
-  sj = build_function_call (objc_setjmp_decl, t);
+  sj = build_function_call (input_location,
+			    objc_setjmp_decl, t);
 
   cond = build2 (COMPOUND_EXPR, TREE_TYPE (sj), enter, sj);
   cond = c_common_truthvalue_conversion (input_location, cond);
@@ -3567,7 +3590,8 @@ next_sjlj_build_exc_extract (tree decl)
 
   t = build_fold_addr_expr (cur_try_context->stack_decl);
   t = tree_cons (NULL, t, NULL);
-  t = build_function_call (objc_exception_extract_decl, t);
+  t = build_function_call (input_location,
+			   objc_exception_extract_decl, t);
   t = convert (TREE_TYPE (decl), t);
   t = build2 (MODIFY_EXPR, void_type_node, decl, t);
 
@@ -3617,7 +3641,8 @@ next_sjlj_build_catch_list (void)
 	      args = tree_cons (NULL, cur_try_context->caught_decl, NULL);
 	      t = objc_get_class_reference (OBJC_TYPE_NAME (TREE_TYPE (type)));
 	      args = tree_cons (NULL, t, args);
-	      t = build_function_call (objc_exception_match_decl, args);
+	      t = build_function_call (input_location,
+				       objc_exception_match_decl, args);
 	      cond = c_common_truthvalue_conversion (input_location, t);
 	    }
 	  t = build3 (COND_EXPR, void_type_node, cond, body, NULL);
@@ -3750,7 +3775,8 @@ next_sjlj_build_try_catch_finally (void)
 			    &TREE_OPERAND (try_fin, 1));
 
   t = tree_cons (NULL, rethrow_decl, NULL);
-  t = build_function_call (objc_exception_throw_decl, t);
+  t = build_function_call (input_location,
+			   objc_exception_throw_decl, t);
   t = build_stmt (COND_EXPR,
 		  c_common_truthvalue_conversion (input_location, 
 						  rethrow_decl),
@@ -3793,7 +3819,8 @@ objc_begin_catch_clause (tree decl)
   compound = c_begin_compound_stmt (true);
 
   /* The parser passed in a PARM_DECL, but what we really want is a VAR_DECL.  */
-  decl = build_decl (VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+  decl = build_decl (input_location,
+		     VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
   lang_hooks.decls.pushdecl (decl);
 
   /* Since a decl is required here by syntax, don't warn if its unused.  */
@@ -3940,7 +3967,8 @@ objc_build_throw_stmt (tree throw_expr)
   /* A throw is just a call to the runtime throw function with the
      object as a parameter.  */
   args = tree_cons (NULL, throw_expr, NULL);
-  return add_stmt (build_function_call (objc_exception_throw_decl, args));
+  return add_stmt (build_function_call (input_location,
+					objc_exception_throw_decl, args));
 }
 
 tree
@@ -3951,13 +3979,15 @@ objc_build_synchronized (location_t star
   /* First lock the mutex.  */
   mutex = save_expr (mutex);
   args = tree_cons (NULL, mutex, NULL);
-  call = build_function_call (objc_sync_enter_decl, args);
+  call = build_function_call (input_location,
+			      objc_sync_enter_decl, args);
   SET_EXPR_LOCATION (call, start_locus);
   add_stmt (call);
 
   /* Build the mutex unlock.  */
   args = tree_cons (NULL, mutex, NULL);
-  call = build_function_call (objc_sync_exit_decl, args);
+  call = build_function_call (input_location,
+			      objc_sync_exit_decl, args);
   SET_EXPR_LOCATION (call, input_location);
 
   /* Put the that and the body in a TRY_FINALLY.  */
@@ -3989,7 +4019,8 @@ build_next_objc_exception_stuff (void)
   tree field_decl, field_decl_chain, index, temp_type;
 
   objc_exception_data_template
-    = start_struct (RECORD_TYPE, get_identifier (UTAG_EXCDATA));
+    = start_struct (input_location, 
+		    RECORD_TYPE, get_identifier (UTAG_EXCDATA));
 
   /* int buf[OBJC_JBLEN]; */
 
@@ -4005,7 +4036,8 @@ build_next_objc_exception_stuff (void)
 				  "pointers");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_exception_data_template, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 objc_exception_data_template, field_decl_chain, NULL_TREE);
 
   /* int _setjmp(...); */
   /* If the user includes <setjmp.h>, this shall be superseded by
@@ -4152,7 +4184,7 @@ build_protocol_template (void)
 {
   tree field_decl, field_decl_chain;
 
-  objc_protocol_template = start_struct (RECORD_TYPE,
+  objc_protocol_template = start_struct (input_location, RECORD_TYPE,
 					 get_identifier (UTAG_PROTOCOL));
 
   /* struct _objc_class *isa; */
@@ -4183,7 +4215,8 @@ build_protocol_template (void)
 				  "class_methods");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_protocol_template, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 objc_protocol_template, field_decl_chain, NULL_TREE);
 }
 
 static tree
@@ -4233,7 +4266,8 @@ build_method_prototype_list_template (tr
 
   /* Generate an unnamed struct definition.  */
 
-  objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
+  objc_ivar_list_record = start_struct (input_location, 
+					RECORD_TYPE, NULL_TREE);
 
   /* int method_count; */
   field_decl = create_field_decl (integer_type_node, "method_count");
@@ -4247,7 +4281,8 @@ build_method_prototype_list_template (tr
 				  "method_list");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 objc_ivar_list_record, field_decl_chain, NULL_TREE);
 
   return objc_ivar_list_record;
 }
@@ -4259,7 +4294,8 @@ build_method_prototype_template (void)
   tree field_decl, field_decl_chain;
 
   proto_record
-    = start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD_PROTOTYPE));
+    = start_struct (input_location,
+		    RECORD_TYPE, get_identifier (UTAG_METHOD_PROTOTYPE));
 
   /* SEL _cmd; */
   field_decl = create_field_decl (objc_selector_type, "_cmd");
@@ -4269,7 +4305,7 @@ build_method_prototype_template (void)
   field_decl = create_field_decl (string_type_node, "method_types");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (proto_record, field_decl_chain, NULL_TREE);
+  finish_struct (input_location, proto_record, field_decl_chain, NULL_TREE);
 
   return proto_record;
 }
@@ -4754,7 +4790,8 @@ build_category_template (void)
 {
   tree field_decl, field_decl_chain;
 
-  objc_category_template = start_struct (RECORD_TYPE,
+  objc_category_template = start_struct (input_location,
+					 RECORD_TYPE,
 					 get_identifier (UTAG_CATEGORY));
 
   /* char *category_name; */
@@ -4782,7 +4819,8 @@ build_category_template (void)
 				  "protocol_list");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_category_template, field_decl_chain, NULL_TREE);
+  finish_struct (input_location, 
+		 objc_category_template, field_decl_chain, NULL_TREE);
 }
 
 /* struct _objc_selector {
@@ -4797,7 +4835,8 @@ build_selector_template (void)
   tree field_decl, field_decl_chain;
 
   objc_selector_template
-    = start_struct (RECORD_TYPE, get_identifier (UTAG_SELECTOR));
+    = start_struct (input_location,
+		    RECORD_TYPE, get_identifier (UTAG_SELECTOR));
 
   /* SEL sel_id; */
   field_decl = create_field_decl (objc_selector_type, "sel_id");
@@ -4807,7 +4846,8 @@ build_selector_template (void)
   field_decl = create_field_decl (string_type_node, "sel_type");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_selector_template, field_decl_chain, NULL_TREE);
+  finish_struct (input_location, 
+		 objc_selector_template, field_decl_chain, NULL_TREE);
 }
 
 /* struct _objc_class {
@@ -4844,7 +4884,7 @@ build_class_template (void)
   tree field_decl, field_decl_chain;
 
   objc_class_template
-    = start_struct (RECORD_TYPE, get_identifier (UTAG_CLASS));
+    = start_struct (input_location, RECORD_TYPE, get_identifier (UTAG_CLASS));
 
   /* struct _objc_class *isa; */
   field_decl = create_field_decl (build_pointer_type (objc_class_template),
@@ -4937,7 +4977,8 @@ build_class_template (void)
 				  "gc_object_type");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_class_template, field_decl_chain, NULL_TREE);
+  finish_struct (input_location, 
+		 objc_class_template, field_decl_chain, NULL_TREE);
 }
 
 /* Generate appropriate forward declarations for an implementation.  */
@@ -5038,7 +5079,9 @@ build_super_template (void)
 {
   tree field_decl, field_decl_chain;
 
-  objc_super_template = start_struct (RECORD_TYPE, get_identifier (UTAG_SUPER));
+  objc_super_template = start_struct (input_location,
+				      RECORD_TYPE, 
+				      get_identifier (UTAG_SUPER));
 
   /* struct _objc_object *self; */
   field_decl = create_field_decl (objc_object_type, "self");
@@ -5049,7 +5092,8 @@ build_super_template (void)
 				  "super_class");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_super_template, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 objc_super_template, field_decl_chain, NULL_TREE);
 }
 
 /* struct _objc_ivar {
@@ -5065,7 +5109,7 @@ build_ivar_template (void)
   tree field_decl, field_decl_chain;
 
   objc_ivar_id = get_identifier (UTAG_IVAR);
-  objc_ivar_record = start_struct (RECORD_TYPE, objc_ivar_id);
+  objc_ivar_record = start_struct (input_location, RECORD_TYPE, objc_ivar_id);
 
   /* char *ivar_name; */
   field_decl = create_field_decl (string_type_node, "ivar_name");
@@ -5079,7 +5123,8 @@ build_ivar_template (void)
   field_decl = create_field_decl (integer_type_node, "ivar_offset");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_ivar_record, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 objc_ivar_record, field_decl_chain, NULL_TREE);
 
   return objc_ivar_record;
 }
@@ -5095,7 +5140,8 @@ build_ivar_list_template (tree list_type
   tree objc_ivar_list_record;
   tree field_decl, field_decl_chain;
 
-  objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
+  objc_ivar_list_record = start_struct (input_location, 
+					RECORD_TYPE, NULL_TREE);
 
   /* int ivar_count; */
   field_decl = create_field_decl (integer_type_node, "ivar_count");
@@ -5109,7 +5155,8 @@ build_ivar_list_template (tree list_type
 				  "ivar_list");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 objc_ivar_list_record, field_decl_chain, NULL_TREE);
 
   return objc_ivar_list_record;
 }
@@ -5126,7 +5173,8 @@ build_method_list_template (tree list_ty
   tree objc_ivar_list_record;
   tree field_decl, field_decl_chain;
 
-  objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
+  objc_ivar_list_record = start_struct (input_location,
+					RECORD_TYPE, NULL_TREE);
 
   /* struct _objc__method_prototype_list *method_next; */
   field_decl = create_field_decl (objc_method_proto_list_ptr,
@@ -5145,7 +5193,8 @@ build_method_list_template (tree list_ty
 				  "method_list");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 objc_ivar_list_record, field_decl_chain, NULL_TREE);
 
   return objc_ivar_list_record;
 }
@@ -5333,7 +5382,8 @@ build_method_template (void)
   tree _SLT_record;
   tree field_decl, field_decl_chain;
 
-  _SLT_record = start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD));
+  _SLT_record = start_struct (input_location,
+			      RECORD_TYPE, get_identifier (UTAG_METHOD));
 
   /* SEL _cmd; */
   field_decl = create_field_decl (objc_selector_type, "_cmd");
@@ -5348,7 +5398,8 @@ build_method_template (void)
 				  "_imp");
   chainon (field_decl_chain, field_decl);
 
-  finish_struct (_SLT_record, field_decl_chain, NULL_TREE);
+  finish_struct (input_location,
+		 _SLT_record, field_decl_chain, NULL_TREE);
 
   return _SLT_record;
 }
@@ -6559,7 +6610,8 @@ build_objc_method_call (int super_flag, 
 
       t = tree_cons (NULL_TREE, selector, NULL_TREE);
       t = tree_cons (NULL_TREE, lookup_object, t);
-      method = build_function_call (sender, t);
+      method = build_function_call (input_location,
+				    sender, t);
 
       /* Pass the object to the method.  */
       method_params = tree_cons (NULL_TREE, object,
@@ -6570,7 +6622,8 @@ build_objc_method_call (int super_flag, 
   /* ??? Selector is not at this point something we can use inside
      the compiler itself.  Set it to garbage for the nonce.  */
   t = build3 (OBJ_TYPE_REF, sender_cast, method, lookup_object, size_zero_node);
-  return build_function_call (t, method_params);
+  return build_function_call (input_location,
+			      t, method_params);
 }
 
 static void
@@ -8352,10 +8405,12 @@ synth_self_and_ucmd_args (void)
     self_type = objc_object_type;
 
   /* id self; */
-  objc_push_parm (build_decl (PARM_DECL, self_id, self_type));
+  objc_push_parm (build_decl (input_location,
+			      PARM_DECL, self_id, self_type));
 
   /* SEL _cmd; */
-  objc_push_parm (build_decl (PARM_DECL, ucmd_id, objc_selector_type));
+  objc_push_parm (build_decl (input_location,
+			      PARM_DECL, ucmd_id, objc_selector_type));
 }
 
 /* Transform an Objective-C method definition into a static C function
@@ -8395,7 +8450,8 @@ start_method_def (tree method)
     {
       tree type = TREE_VALUE (TREE_TYPE (parmlist)), parm;
 
-      parm = build_decl (PARM_DECL, KEYWORD_ARG_NAME (parmlist), type);
+      parm = build_decl (input_location,
+			 PARM_DECL, KEYWORD_ARG_NAME (parmlist), type);
       objc_push_parm (parm);
       parmlist = TREE_CHAIN (parmlist);
     }
@@ -8545,7 +8601,8 @@ objc_start_function (tree name, tree typ
 #endif
 		     )
 {
-  tree fndecl = build_decl (FUNCTION_DECL, name, type);
+  tree fndecl = build_decl (input_location,
+			    FUNCTION_DECL, name, type);
 
 #ifdef OBJCPLUS
   DECL_ARGUMENTS (fndecl) = params;
@@ -8581,7 +8638,8 @@ objc_start_function (tree name, tree typ
   push_scope ();
   declare_parm_level ();
   DECL_RESULT (current_function_decl)
-    = build_decl (RESULT_DECL, NULL_TREE,
+    = build_decl (input_location,
+		  RESULT_DECL, NULL_TREE,
 		  TREE_TYPE (TREE_TYPE (current_function_decl)));
   DECL_ARTIFICIAL (DECL_RESULT (current_function_decl)) = 1;
   DECL_IGNORED_P (DECL_RESULT (current_function_decl)) = 1;
@@ -8714,7 +8772,8 @@ get_super_receiver (void)
 
       if (!UOBJC_SUPER_decl)
       {
-	UOBJC_SUPER_decl = build_decl (VAR_DECL, get_identifier (TAG_SUPER),
+	UOBJC_SUPER_decl = build_decl (input_location,
+				       VAR_DECL, get_identifier (TAG_SUPER),
 				       objc_super_template);
 	/* This prevents `unused variable' warnings when compiling with -Wall.  */
 	TREE_USED (UOBJC_SUPER_decl) = 1;
@@ -8781,7 +8840,8 @@ get_super_receiver (void)
 	      assemble_external (super_class);
 	      super_class
 		= build_function_call
-		  (super_class,
+		  (input_location,
+		   super_class,
 		   build_tree_list
 		   (NULL_TREE,
 		    my_build_string_pointer
@@ -9327,7 +9387,8 @@ handle_class_ref (tree chain)
 #endif
 
   /* Make a decl for this name, so we can use its address in a tree.  */
-  decl = build_decl (VAR_DECL, get_identifier (string), char_type_node);
+  decl = build_decl (input_location,
+		     VAR_DECL, get_identifier (string), char_type_node);
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 1;
 
@@ -9338,7 +9399,8 @@ handle_class_ref (tree chain)
   sprintf (string, "%sobjc_class_ref_%s",
 	   (flag_next_runtime ? "." : "__"), name);
   exp = build1 (ADDR_EXPR, string_type_node, decl);
-  decl = build_decl (VAR_DECL, get_identifier (string), string_type_node);
+  decl = build_decl (input_location,
+		     VAR_DECL, get_identifier (string), string_type_node);
   DECL_INITIAL (decl) = exp;
   TREE_STATIC (decl) = 1;
   TREE_USED (decl) = 1;
@@ -9398,7 +9460,8 @@ handle_impent (struct imp_entry *impent)
       tree decl, init;
 
       init = build_int_cst (c_common_type_for_size (BITS_PER_WORD, 1), 0);
-      decl = build_decl (VAR_DECL, get_identifier (string), TREE_TYPE (init));
+      decl = build_decl (input_location,
+			 VAR_DECL, get_identifier (string), TREE_TYPE (init));
       TREE_PUBLIC (decl) = 1;
       TREE_READONLY (decl) = 1;
       TREE_USED (decl) = 1;
Index: cgraphunit.c
===================================================================
--- cgraphunit.c	(revision 141983)
+++ cgraphunit.c	(working copy)
@@ -1362,11 +1362,12 @@ cgraph_build_static_cdtor (char which, t
   sprintf (which_buf, "%c_%.5d_%d", which, priority, counter++);
   name = get_file_function_name (which_buf);
 
-  decl = build_decl (FUNCTION_DECL, name,
+  decl = build_decl (input_location, FUNCTION_DECL, name,
 		     build_function_type (void_type_node, void_list_node));
   current_function_decl = decl;
 
-  resdecl = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
+  resdecl = build_decl (input_location,
+			RESULT_DECL, NULL_TREE, void_type_node);
   DECL_ARTIFICIAL (resdecl) = 1;
   DECL_RESULT (decl) = resdecl;
 
Index: testsuite/gcc.dg/old-style-prom-3.c
===================================================================
--- testsuite/gcc.dg/old-style-prom-3.c	(revision 141983)
+++ testsuite/gcc.dg/old-style-prom-3.c	(working copy)
@@ -7,8 +7,8 @@ float f (float, float); /* { dg-error "p
 
 float
 f (x, y)
-     float x;
-     float y;
-{ /* { dg-error "promoted argument '.' doesn't match prototype" } */
+     float x; /* { dg-error "promoted argument 'x' doesn't match prototype" } */
+     float y; /* { dg-error "promoted argument 'y' doesn't match prototype" } */
+{
   return x + y;
 }
Index: testsuite/gcc.dg/enum-compat-1.c
===================================================================
--- testsuite/gcc.dg/enum-compat-1.c	(revision 141983)
+++ testsuite/gcc.dg/enum-compat-1.c	(working copy)
@@ -12,8 +12,8 @@ enum e2 {c, d};
 void f(enum e1); /* { dg-error "prototype" "error at decl" } */
 
 void f(x)
-     enum e2 x;
-{ /* { dg-error "doesn't match prototype" "error at defn" } */
+     enum e2 x; /* { dg-error "doesn't match prototype" } */
+{
   return;
 }
 
Index: testsuite/gcc.dg/dremf-type-compat-2.c
===================================================================
--- testsuite/gcc.dg/dremf-type-compat-2.c	(revision 141983)
+++ testsuite/gcc.dg/dremf-type-compat-2.c	(working copy)
@@ -11,8 +11,8 @@ float dremf (float, float); /* { dg-warn
 
 float
 dremf (x, y)
-     float x;
-     float y;
-{ /* { dg-warning "promoted argument '.' doesn't match prototype" } */
+     float x; /* { dg-warning "promoted argument 'x' doesn't match prototype" } */
+     float y; /* { dg-warning "promoted argument 'y' doesn't match prototype" } */
+{
   return x + y;
 }
Index: testsuite/gcc.dg/builtins-30.c
===================================================================
--- testsuite/gcc.dg/builtins-30.c	(revision 141983)
+++ testsuite/gcc.dg/builtins-30.c	(working copy)
@@ -1,29 +1,27 @@
 /* { dg-do compile } */
-/* { dg-options "-Wall -Wshadow" } */
+/* { dg-options "-Wall -Wshadow -fshow-column" } */
 
 extern double strtod (const char *, char **);
 #define UNUSED __attribute__ ((unused))
 
 /* A built-in function may be overridden by an old-style definition
    specifying too few arguments... */
-double cos ()  /* { dg-warning "shadows a built-in" } */
+double cos ()  /* { dg-warning "shadows a built-in|number of arguments" } */ 
 {
-  /* { dg-warning "number of arguments doesn't match built-in prototype" "built-in" { target *-*-* } 10 } */
   return strtod ("nan", 0);
 }
 
 /* the right number, but the wrong type, arguments... */
-double sin (foo)  /* { dg-warning "shadows a built-in" } */
-     int foo UNUSED;
-{  /* { dg-warning "argument 'foo' doesn't match built-in prototype" } */
+double sin (foo)  /* { dg-warning "8:shadows a built-in" } */
+     int foo UNUSED; /* { dg-warning "10:argument 'foo' doesn't match built-in prototype" } */
+{
   return strtod ("nan", 0);
 }
 
 /* or too many arguments.  */
-long double cosl (foo, bar)  /* { dg-warning "shadows a built-in" } */
-     const char *foo UNUSED;
+long double cosl (foo, bar)  /* { dg-warning "shadows a built-in|number of arguments" } */
+     const char *foo UNUSED; /* { dg-warning "18:argument 'foo' doesn't match" } */
      int bar UNUSED;
-{  /* { dg-warning "number of arguments doesn't match built-in prototype" } */
-  /* { dg-warning "argument 'foo' doesn't match built-in prototype" "foo" { target *-*-* } 26 } */
+{
   return strtod ("nan", 0);
 }
Index: testsuite/gcc.dg/old-style-prom-2.c
===================================================================
--- testsuite/gcc.dg/old-style-prom-2.c	(revision 141983)
+++ testsuite/gcc.dg/old-style-prom-2.c	(working copy)
@@ -7,8 +7,8 @@ float f (float, float); /* { dg-warning 
 
 float
 f (x, y)
-     float x;
-     float y;
-{ /* { dg-warning "promoted argument '.' doesn't match prototype" } */
+     float x; /* { dg-warning "promoted argument 'x' doesn't match prototype" } */
+     float y; /* { dg-warning "promoted argument 'y' doesn't match prototype" } */
+{
   return x + y;
 }
Index: testsuite/gcc.dg/pr15698-1.c
===================================================================
--- testsuite/gcc.dg/pr15698-1.c	(revision 141983)
+++ testsuite/gcc.dg/pr15698-1.c	(working copy)
@@ -17,7 +17,7 @@ int foobar ()
 }
 
 char *rindex(a, b)
-     register char *a, b;
-{ /* { dg-warning "argument 'a' doesn't match built-in prototype" } */
+     register char *a, b; /* { dg-warning "argument 'a' doesn't match built-in prototype" } */
+{
   return 0;
 }
Index: testsuite/gcc.dg/pr20368-1.c
===================================================================
--- testsuite/gcc.dg/pr20368-1.c	(revision 141983)
+++ testsuite/gcc.dg/pr20368-1.c	(working copy)
@@ -6,7 +6,7 @@
 extern __typeof (f) g; /* { dg-error "'f' undeclared here \\(not in a function\\)" } */
 
 int
-f (x)
-     float x; /* { dg-warning "function declaration isn't a prototype" } */
+f (x) /* { dg-warning "function declaration isn't a prototype" } */
+     float x;
 {
 }
Index: testsuite/gcc.dg/dremf-type-compat-3.c
===================================================================
--- testsuite/gcc.dg/dremf-type-compat-3.c	(revision 141983)
+++ testsuite/gcc.dg/dremf-type-compat-3.c	(working copy)
@@ -11,8 +11,8 @@ float dremf (float, float); /* { dg-erro
 
 float
 dremf (x, y)
-     float x;
-     float y;
-{ /* { dg-error "promoted argument '.' doesn't match prototype" } */
+     float x; /* { dg-error "promoted argument 'x' doesn't match prototype" } */
+     float y; /* { dg-error "promoted argument 'y' doesn't match prototype" } */
+{
   return x + y;
 }
Index: objcp/objcp-decl.c
===================================================================
--- objcp/objcp-decl.c	(revision 141983)
+++ objcp/objcp-decl.c	(working copy)
@@ -44,7 +44,8 @@ along with GCC; see the file COPYING3.  
 /* Hacks to simulate start_struct() and finish_struct(). */
 
 tree 
-objcp_start_struct (enum tree_code code ATTRIBUTE_UNUSED, tree name)
+objcp_start_struct (location_t loc ATTRIBUTE_UNUSED,
+		    enum tree_code code ATTRIBUTE_UNUSED, tree name)
 {
   tree s;
   /* The idea here is to mimic the actions that the C++ parser takes when
@@ -62,7 +63,8 @@ objcp_start_struct (enum tree_code code 
 }
 
 tree 
-objcp_finish_struct (tree t, tree fieldlist, tree attributes)
+objcp_finish_struct (location_t loc ATTRIBUTE_UNUSED,
+		     tree t, tree fieldlist, tree attributes)
 {
   tree field, next_field;
 
Index: objcp/objcp-decl.h
===================================================================
--- objcp/objcp-decl.h	(revision 141983)
+++ objcp/objcp-decl.h	(working copy)
@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3.  
 #ifndef GCC_OBJCP_DECL_H
 #define GCC_OBJCP_DECL_H
 
-extern tree objcp_start_struct (enum tree_code, tree);
-extern tree objcp_finish_struct (tree, tree, tree);
+extern tree objcp_start_struct (location_t, enum tree_code, tree);
+extern tree objcp_finish_struct (location_t, tree, tree, tree);
 extern void objcp_finish_function (void);
 extern tree objcp_build_function_call (tree, tree);
 extern tree objcp_xref_tag (enum tree_code, tree);
@@ -37,10 +37,10 @@ extern tree objcp_end_compound_stmt (tre
    invoke the original C++ functions if needed).  */
 #ifdef OBJCP_REMAP_FUNCTIONS
 
-#define start_struct(code, name) \
-	objcp_start_struct (code, name)
-#define finish_struct(t, fieldlist, attributes) \
-	objcp_finish_struct (t, fieldlist, attributes)
+#define start_struct(loc, code, name) \
+	objcp_start_struct (loc, code, name)
+#define finish_struct(loc, t, fieldlist, attributes) \
+	objcp_finish_struct (loc, t, fieldlist, attributes)
 #define finish_function() \
 	objcp_finish_function ()
 #define xref_tag(code, name) \
Index: cp/typeck.c
===================================================================
--- cp/typeck.c	(revision 141983)
+++ cp/typeck.c	(working copy)
@@ -2820,7 +2820,8 @@ get_member_function_from_ptrfunc (tree *
 
 /* Used by the C-common bits.  */
 tree
-build_function_call (tree function, tree params)
+build_function_call (location_t loc ATTRIBUTE_UNUSED, 
+		     tree function, tree params)
 {
   return cp_build_function_call (function, params, tf_warning_or_error);
 }
Index: cp/init.c
===================================================================
--- cp/init.c	(revision 141983)
+++ cp/init.c	(working copy)
@@ -2494,7 +2494,8 @@ build_java_class_ref (tree type)
   class_decl = IDENTIFIER_GLOBAL_VALUE (name);
   if (class_decl == NULL_TREE)
     {
-      class_decl = build_decl (VAR_DECL, name, TREE_TYPE (jclass_node));
+      class_decl = build_decl (input_location,
+			       VAR_DECL, name, TREE_TYPE (jclass_node));
       TREE_STATIC (class_decl) = 1;
       DECL_EXTERNAL (class_decl) = 1;
       TREE_PUBLIC (class_decl) = 1;
@@ -2648,11 +2649,11 @@ create_temporary_var (tree type)
 {
   tree decl;
 
-  decl = build_decl (VAR_DECL, NULL_TREE, type);
+  decl = build_decl (input_location,
+		     VAR_DECL, NULL_TREE, type);
   TREE_USED (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
   DECL_IGNORED_P (decl) = 1;
-  DECL_SOURCE_LOCATION (decl) = input_location;
   DECL_CONTEXT (decl) = current_function_decl;
 
   return decl;
Index: cp/class.c
===================================================================
--- cp/class.c	(revision 141983)
+++ cp/class.c	(working copy)
@@ -3624,7 +3624,8 @@ build_base_field (record_layout_info rli
       CLASSTYPE_EMPTY_P (t) = 0;
 
       /* Create the FIELD_DECL.  */
-      decl = build_decl (FIELD_DECL, NULL_TREE, CLASSTYPE_AS_BASE (basetype));
+      decl = build_decl (input_location,
+			 FIELD_DECL, NULL_TREE, CLASSTYPE_AS_BASE (basetype));
       DECL_ARTIFICIAL (decl) = 1;
       DECL_IGNORED_P (decl) = 1;
       DECL_FIELD_CONTEXT (decl) = t;
@@ -4412,7 +4413,8 @@ create_vtable_ptr (tree t, tree* virtual
 	 stores cannot alias stores to void*!  */
       tree field;
 
-      field = build_decl (FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node);
+      field = build_decl (input_location, 
+			  FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node);
       DECL_VIRTUAL_P (field) = 1;
       DECL_ARTIFICIAL (field) = 1;
       DECL_FIELD_CONTEXT (field) = t;
@@ -4992,7 +4994,8 @@ layout_class_type (tree t, tree *virtual
 	{
 	  tree padding_field;
 
-	  padding_field = build_decl (FIELD_DECL,
+	  padding_field = build_decl (input_location,
+				      FIELD_DECL,
 				      NULL_TREE,
 				      char_type_node);
 	  DECL_BIT_FIELD (padding_field) = 1;
@@ -5080,7 +5083,8 @@ layout_class_type (tree t, tree *virtual
       for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
 	if (TREE_CODE (field) == FIELD_DECL)
 	  {
-	    *next_field = build_decl (FIELD_DECL,
+	    *next_field = build_decl (input_location,
+				      FIELD_DECL,
 				      DECL_NAME (field),
 				      TREE_TYPE (field));
 	    DECL_CONTEXT (*next_field) = base_t;
@@ -5121,7 +5125,8 @@ layout_class_type (tree t, tree *virtual
   /* Make sure not to create any structures with zero size.  */
   if (integer_zerop (rli_size_unit_so_far (rli)) && CLASSTYPE_EMPTY_P (t))
     place_field (rli,
-		 build_decl (FIELD_DECL, NULL_TREE, char_type_node));
+		 build_decl (input_location,
+			     FIELD_DECL, NULL_TREE, char_type_node));
 
   /* Let the back end lay out the type.  */
   finish_record_layout (rli, /*free_p=*/true);
Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 141983)
+++ cp/decl.c	(working copy)
@@ -94,7 +94,7 @@ static tree get_atexit_node (void);
 static tree get_dso_handle_node (void);
 static tree start_cleanup_fn (void);
 static void end_cleanup_fn (void);
-static tree cp_make_fname_decl (tree, int);
+static tree cp_make_fname_decl (location_t, tree, int);
 static void initialize_predefined_identifiers (void);
 static tree check_special_function_return_type
 	(special_function_kind, tree, tree);
@@ -856,7 +856,7 @@ create_implicit_typedef (tree name, tree
 {
   tree decl;
 
-  decl = build_decl (TYPE_DECL, name, type);
+  decl = build_decl (input_location, TYPE_DECL, name, type);
   DECL_ARTIFICIAL (decl) = 1;
   /* There are other implicit type declarations, like the one *within*
      a class that allows you to write `S::S'.  We must distinguish
@@ -2357,7 +2357,7 @@ make_label_decl (tree id, int local_p)
   void **slot;
   tree decl;
 
-  decl = build_decl (LABEL_DECL, id, void_type_node);
+  decl = build_decl (input_location, LABEL_DECL, id, void_type_node);
 
   DECL_CONTEXT (decl) = current_function_decl;
   DECL_MODE (decl) = VOIDmode;
@@ -2784,7 +2784,7 @@ pop_switch (void)
    is a bad place for one.  */
 
 tree
-finish_case_label (tree low_value, tree high_value)
+finish_case_label (location_t loc, tree low_value, tree high_value)
 {
   tree cond, r;
   struct cp_binding_level *p;
@@ -2795,7 +2795,7 @@ finish_case_label (tree low_value, tree 
 
       /* For templates, just add the case label; we'll do semantic
 	 analysis at instantiation-time.  */
-      label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
+      label = build_decl (loc, LABEL_DECL, NULL_TREE, NULL_TREE);
       return add_stmt (build_case_label (low_value, high_value, label));
     }
 
@@ -2807,7 +2807,7 @@ finish_case_label (tree low_value, tree 
   if (!check_switch_goto (switch_stack->level))
     return error_mark_node;
 
-  r = c_add_case_label (switch_stack->cases, cond, TREE_TYPE (cond),
+  r = c_add_case_label (loc, switch_stack->cases, cond, TREE_TYPE (cond),
 			low_value, high_value);
 
   /* After labels, make any new cleanups in the function go into their
@@ -2903,7 +2903,7 @@ build_typename_type (tree context, tree 
       TYPENAME_IS_CLASS_P (t) = ti.class_p;
 
       /* Build the corresponding TYPE_DECL.  */
-      d = build_decl (TYPE_DECL, name, t);
+      d = build_decl (input_location, TYPE_DECL, name, t);
       TYPE_NAME (TREE_TYPE (d)) = d;
       TYPE_STUB_DECL (TREE_TYPE (d)) = d;
       DECL_CONTEXT (d) = FROB_CONTEXT (context);
@@ -3095,7 +3095,7 @@ make_unbound_class_template (tree contex
   SET_TYPE_STRUCTURAL_EQUALITY (t);
 
   /* Build the corresponding TEMPLATE_DECL.  */
-  d = build_decl (TEMPLATE_DECL, name, t);
+  d = build_decl (input_location, TEMPLATE_DECL, name, t);
   TYPE_NAME (TREE_TYPE (d)) = d;
   TYPE_STUB_DECL (TREE_TYPE (d)) = d;
   DECL_CONTEXT (d) = FROB_CONTEXT (context);
@@ -3132,7 +3132,7 @@ record_builtin_type (enum rid rid_index,
      up built-in types by name.  */
   if (tname)
     {
-      tdecl = build_decl (TYPE_DECL, tname, type);
+      tdecl = build_decl (BUILTINS_LOCATION, TYPE_DECL, tname, type);
       DECL_ARTIFICIAL (tdecl) = 1;
       SET_IDENTIFIER_GLOBAL_VALUE (tname, tdecl);
     }
@@ -3140,7 +3140,7 @@ record_builtin_type (enum rid rid_index,
     {
       if (!tdecl)
 	{
-	  tdecl = build_decl (TYPE_DECL, rname, type);
+	  tdecl = build_decl (BUILTINS_LOCATION, TYPE_DECL, rname, type);
 	  DECL_ARTIFICIAL (tdecl) = 1;
 	}
       SET_IDENTIFIER_GLOBAL_VALUE (rname, tdecl);
@@ -3192,7 +3192,8 @@ record_builtin_java_type (const char* na
 static void
 record_unknown_type (tree type, const char* name)
 {
-  tree decl = pushdecl (build_decl (TYPE_DECL, get_identifier (name), type));
+  tree decl = pushdecl (build_decl (UNKNOWN_LOCATION,
+				    TYPE_DECL, get_identifier (name), type));
   /* Make sure the "unknown type" typedecl gets ignored for debug info.  */
   DECL_IGNORED_P (decl) = 1;
   TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
@@ -3466,20 +3467,21 @@ cp_fname_init (const char* name, tree *t
   return init;
 }
 
-/* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give the
-   decl, NAME is the initialization string and TYPE_DEP indicates whether
-   NAME depended on the type of the function. We make use of that to detect
-   __PRETTY_FUNCTION__ inside a template fn. This is being done
-   lazily at the point of first use, so we mustn't push the decl now.  */
+/* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give
+   the decl, LOC is the location to give the decl, NAME is the
+   initialization string and TYPE_DEP indicates whether NAME depended
+   on the type of the function. We make use of that to detect
+   __PRETTY_FUNCTION__ inside a template fn. This is being done lazily
+   at the point of first use, so we mustn't push the decl now.  */
 
 static tree
-cp_make_fname_decl (tree id, int type_dep)
+cp_make_fname_decl (location_t loc, tree id, int type_dep)
 {
   const char *const name = (type_dep && processing_template_decl
 			    ? NULL : fname_as_string (type_dep));
   tree type;
   tree init = cp_fname_init (name, &type);
-  tree decl = build_decl (VAR_DECL, id, type);
+  tree decl = build_decl (loc, VAR_DECL, id, type);
 
   if (name)
     free (CONST_CAST (char *, name));
@@ -5851,7 +5853,7 @@ declare_global_var (tree name, tree type
   tree decl;
 
   push_to_top_level ();
-  decl = build_decl (VAR_DECL, name, type);
+  decl = build_decl (input_location, VAR_DECL, name, type);
   TREE_PUBLIC (decl) = 1;
   DECL_EXTERNAL (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
@@ -6903,7 +6905,7 @@ grokvardecl (tree type,
 	  || TYPE_P (scope)))
     decl = build_lang_decl (VAR_DECL, name, type);
   else
-    decl = build_decl (VAR_DECL, name, type);
+    decl = build_decl (input_location, VAR_DECL, name, type);
 
   if (explicit_scope && TREE_CODE (explicit_scope) == NAMESPACE_DECL)
     set_decl_namespace (decl, explicit_scope, 0);
@@ -7014,10 +7016,11 @@ build_ptrmemfunc_type (tree type)
   /* ... and not really a class type.  */
   SET_CLASS_TYPE_P (t, 0);
 
-  field = build_decl (FIELD_DECL, pfn_identifier, type);
+  field = build_decl (input_location, FIELD_DECL, pfn_identifier, type);
   fields = field;
 
-  field = build_decl (FIELD_DECL, delta_identifier, delta_type_node);
+  field = build_decl (input_location, FIELD_DECL, delta_identifier, 
+		      delta_type_node);
   TREE_CHAIN (field) = fields;
   fields = field;
 
@@ -8712,7 +8715,7 @@ grokdeclarator (const cp_declarator *dec
       if (decl_context == FIELD)
 	decl = build_lang_decl (TYPE_DECL, unqualified_id, type);
       else
-	decl = build_decl (TYPE_DECL, unqualified_id, type);
+	decl = build_decl (input_location, TYPE_DECL, unqualified_id, type);
       if (id_declarator && declarator->u.id.qualifying_scope) {
 	error ("%Jtypedef name may not be a nested-name-specifier", decl);
 	TREE_TYPE (decl) = error_mark_node;
@@ -9222,7 +9225,8 @@ grokdeclarator (const cp_declarator *dec
 	      }
 	    else
 	      {
-		decl = build_decl (FIELD_DECL, unqualified_id, type);
+		decl = build_decl (input_location,
+				   FIELD_DECL, unqualified_id, type);
 		DECL_NONADDRESSABLE_P (decl) = bitfield;
 		if (bitfield && !unqualified_id)
 		  TREE_NO_WARNING (decl) = 1;
@@ -11265,7 +11269,7 @@ build_enumerator (tree name, tree value,
   else
     /* It's a global enum, or it's local to a function.  (Note local to
       a function could mean local to a class method.  */
-    decl = build_decl (CONST_DECL, name, type);
+    decl = build_decl (input_location, CONST_DECL, name, type);
 
   DECL_CONTEXT (decl) = FROB_CONTEXT (context);
   TREE_CONSTANT (decl) = 1;
@@ -11492,7 +11496,7 @@ start_preparsed_function (tree decl1, tr
     {
       tree resdecl;
 
-      resdecl = build_decl (RESULT_DECL, 0, restype);
+      resdecl = build_decl (input_location, RESULT_DECL, 0, restype);
       DECL_ARTIFICIAL (resdecl) = 1;
       DECL_IGNORED_P (resdecl) = 1;
       DECL_RESULT (decl1) = resdecl;
@@ -11735,7 +11739,8 @@ start_preparsed_function (tree decl1, tr
       || (DECL_CONSTRUCTOR_P (decl1)
 	  && targetm.cxx.cdtor_returns_this ()))
     {
-      cdtor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
+      cdtor_label = build_decl (input_location, 
+				LABEL_DECL, NULL_TREE, NULL_TREE);
       DECL_CONTEXT (cdtor_label) = current_function_decl;
     }
 
Index: cp/method.c
===================================================================
--- cp/method.c	(revision 141983)
+++ cp/method.c	(working copy)
@@ -126,7 +126,8 @@ make_thunk (tree function, bool this_adj
   gcc_assert (TYPE_SIZE (DECL_CONTEXT (function))
 	      && TYPE_BEING_DEFINED (DECL_CONTEXT (function)));
 
-  thunk = build_decl (FUNCTION_DECL, NULL_TREE, TREE_TYPE (function));
+  thunk = build_decl (DECL_SOURCE_LOCATION (function),
+		      FUNCTION_DECL, NULL_TREE, TREE_TYPE (function));
   DECL_LANG_SPECIFIC (thunk) = DECL_LANG_SPECIFIC (function);
   cxx_dup_lang_specific_decl (thunk);
   DECL_THUNKS (thunk) = NULL_TREE;
@@ -262,7 +263,8 @@ static GTY (()) int thunk_labelno;
 tree
 make_alias_for (tree function, tree newid)
 {
-  tree alias = build_decl (FUNCTION_DECL, newid, TREE_TYPE (function));
+  tree alias = build_decl (DECL_SOURCE_LOCATION (function),
+			   FUNCTION_DECL, newid, TREE_TYPE (function));
   DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function);
   cxx_dup_lang_specific_decl (alias);
   DECL_CONTEXT (alias) = NULL;
@@ -428,7 +430,8 @@ use_thunk (tree thunk_fndecl, bool emit_
       
       current_function_decl = thunk_fndecl;
       DECL_RESULT (thunk_fndecl)
-	= build_decl (RESULT_DECL, 0, integer_type_node);
+	= build_decl (DECL_SOURCE_LOCATION (thunk_fndecl),
+		      RESULT_DECL, 0, integer_type_node);
       fnname = IDENTIFIER_POINTER (DECL_NAME (thunk_fndecl));
       /* The back end expects DECL_INITIAL to contain a BLOCK, so we
 	 create one.  */
Index: cp/rtti.c
===================================================================
--- cp/rtti.c	(revision 141983)
+++ cp/rtti.c	(working copy)
@@ -1162,7 +1162,8 @@ create_pseudo_type_info (int tk, const c
     sprintf (pseudo_name + strlen (pseudo_name), "%d", tk - TK_FIXED);
 
   /* First field is the pseudo type_info base class.  */
-  fields = build_decl (FIELD_DECL, NULL_TREE,
+  fields = build_decl (input_location,
+		       FIELD_DECL, NULL_TREE,
 		       VEC_index (tinfo_s, tinfo_descs,
 				  TK_TYPE_INFO_TYPE)->type);
 
@@ -1291,9 +1292,12 @@ get_pseudo_ti_index (tree type)
 	      push_abi_namespace ();
 	      create_pseudo_type_info
 		(ix, "__vmi_class_type_info",
-		 build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
-		 build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
-		 build_decl (FIELD_DECL, NULL_TREE, base_array),
+		 build_decl (input_location,
+			     FIELD_DECL, NULL_TREE, integer_type_node),
+		 build_decl (input_location,
+			     FIELD_DECL, NULL_TREE, integer_type_node),
+		 build_decl (input_location,
+			     FIELD_DECL, NULL_TREE, base_array),
 		 NULL);
 	      pop_abi_namespace ();
 	      break;
@@ -1325,10 +1329,12 @@ create_tinfo_types (void)
   {
     tree field, fields;
 
-    field = build_decl (FIELD_DECL, NULL_TREE, const_ptr_type_node);
+    field = build_decl (BUILTINS_LOCATION,
+			FIELD_DECL, NULL_TREE, const_ptr_type_node);
     fields = field;
 
-    field = build_decl (FIELD_DECL, NULL_TREE, const_string_type_node);
+    field = build_decl (BUILTINS_LOCATION,
+			FIELD_DECL, NULL_TREE, const_string_type_node);
     TREE_CHAIN (field) = fields;
     fields = field;
 
@@ -1354,7 +1360,8 @@ create_tinfo_types (void)
   /* Single public non-virtual base class. Add pointer to base class.
      This is really a descendant of __class_type_info.  */
   create_pseudo_type_info (TK_SI_CLASS_TYPE, "__si_class_type_info",
-	    build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
+	    build_decl (BUILTINS_LOCATION,
+			FIELD_DECL, NULL_TREE, type_info_ptr_type),
 	    NULL);
 
   /* Base class internal helper. Pointer to base type, offset to base,
@@ -1362,10 +1369,12 @@ create_tinfo_types (void)
   {
     tree field, fields;
 
-    field = build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type);
+    field = build_decl (BUILTINS_LOCATION,
+			FIELD_DECL, NULL_TREE, type_info_ptr_type);
     fields = field;
 
-    field = build_decl (FIELD_DECL, NULL_TREE, integer_types[itk_long]);
+    field = build_decl (BUILTINS_LOCATION,
+			FIELD_DECL, NULL_TREE, integer_types[itk_long]);
     TREE_CHAIN (field) = fields;
     fields = field;
 
@@ -1382,8 +1391,10 @@ create_tinfo_types (void)
      and pointer to the pointed to type.  This is really a descendant of
      __pbase_type_info.  */
   create_pseudo_type_info (TK_POINTER_TYPE, "__pointer_type_info",
-       build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
-       build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
+       build_decl (BUILTINS_LOCATION, 
+		   FIELD_DECL, NULL_TREE, integer_type_node),
+       build_decl (BUILTINS_LOCATION,
+		   FIELD_DECL, NULL_TREE, type_info_ptr_type),
        NULL);
 
   /* Pointer to member data type_info.  Add qualifications flags,
@@ -1391,9 +1402,12 @@ create_tinfo_types (void)
      This is really a descendant of __pbase_type_info.  */
   create_pseudo_type_info (TK_POINTER_MEMBER_TYPE,
        "__pointer_to_member_type_info",
-	build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
-	build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
-	build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
+	build_decl (BUILTINS_LOCATION,
+		    FIELD_DECL, NULL_TREE, integer_type_node),
+	build_decl (BUILTINS_LOCATION,
+		    FIELD_DECL, NULL_TREE, type_info_ptr_type),
+	build_decl (BUILTINS_LOCATION,
+		    FIELD_DECL, NULL_TREE, type_info_ptr_type),
 	NULL);
 
   pop_abi_namespace ();
Index: cp/tree.c
===================================================================
--- cp/tree.c	(revision 141983)
+++ cp/tree.c	(working copy)
@@ -285,7 +285,8 @@ build_target_expr (tree decl, tree value
 static tree
 build_local_temp (tree type)
 {
-  tree slot = build_decl (VAR_DECL, NULL_TREE, type);
+  tree slot = build_decl (input_location,
+			  VAR_DECL, NULL_TREE, type);
   DECL_ARTIFICIAL (slot) = 1;
   DECL_IGNORED_P (slot) = 1;
   DECL_CONTEXT (slot) = current_function_decl;
@@ -1287,7 +1288,8 @@ bind_template_template_parm (tree t, tre
   tree t2;
 
   t2 = cxx_make_type (BOUND_TEMPLATE_TEMPLATE_PARM);
-  decl = build_decl (TYPE_DECL, DECL_NAME (decl), NULL_TREE);
+  decl = build_decl (input_location,
+		     TYPE_DECL, DECL_NAME (decl), NULL_TREE);
 
   /* These nodes have to be created to reflect new TYPE_DECL and template
      arguments.  */
Index: cp/cp-tree.h
===================================================================
--- cp/cp-tree.h	(revision 141983)
+++ cp/cp-tree.h	(working copy)
@@ -4709,7 +4709,7 @@ extern tree finish_continue_stmt		(void)
 extern tree begin_switch_stmt			(void);
 extern void finish_switch_cond			(tree, tree);
 extern void finish_switch_stmt			(tree);
-extern tree finish_case_label			(tree, tree);
+extern tree finish_case_label			(location_t, tree, tree);
 extern tree finish_goto_stmt			(tree);
 extern tree begin_try_block			(void);
 extern void finish_try_block			(tree);
Index: cp/cp-gimplify.c
===================================================================
--- cp/cp-gimplify.c	(revision 141983)
+++ cp/cp-gimplify.c	(working copy)
@@ -50,7 +50,7 @@ static tree bc_label[2];
 static tree
 begin_bc_block (enum bc_t bc)
 {
-  tree label = create_artificial_label ();
+  tree label = create_artificial_label (input_location);
   TREE_CHAIN (label) = bc_label[bc];
   bc_label[bc] = label;
   return label;
@@ -226,7 +226,7 @@ gimplify_cp_loop (tree cond, tree body, 
 	 back through the main gimplifier to lower it.  Given that we
 	 have to gimplify the loop body NOW so that we can resolve
 	 break/continue stmts, seems easier to just expand to gotos.  */
-      top = gimple_build_label (create_artificial_label ());
+      top = gimple_build_label (create_artificial_label (stmt_locus));
 
       /* If we have an exit condition, then we build an IF with gotos either
 	 out of the loop, or to the top of it.  If there's no exit condition,
@@ -247,7 +247,8 @@ gimplify_cp_loop (tree cond, tree body, 
 	    {
 	      if (incr)
 		{
-		  entry = gimple_build_label (create_artificial_label ());
+		  entry = gimple_build_label 
+		    (create_artificial_label (stmt_locus));
 		  stmt = gimple_build_goto (gimple_label_label (entry));
 		}
 	      else
@@ -948,7 +949,7 @@ cxx_omp_clause_apply_fn (tree fn, tree a
 	  append_to_statement_list (t, &ret);
 	}
 
-      lab = create_artificial_label ();
+      lab = create_artificial_label (input_location);
       t = build1 (LABEL_EXPR, void_type_node, lab);
       append_to_statement_list (t, &ret);
 
Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 141983)
+++ cp/pt.c	(working copy)
@@ -380,7 +380,8 @@ push_inline_template_parms_recursive (tr
 	       It is ugly that we recreate this here; the original
 	       version built in process_template_parm is no longer
 	       available.  */
-	    tree decl = build_decl (CONST_DECL, DECL_NAME (parm),
+	    tree decl = build_decl (DECL_SOURCE_LOCATION (parm),
+				    CONST_DECL, DECL_NAME (parm),
 				    TREE_TYPE (parm));
 	    DECL_ARTIFICIAL (decl) = 1;
 	    TREE_CONSTANT (decl) = 1;
@@ -2923,7 +2924,8 @@ reduce_template_parm_level (tree index, 
       tree orig_decl = TEMPLATE_PARM_DECL (index);
       tree decl, t;
 
-      decl = build_decl (TREE_CODE (orig_decl), DECL_NAME (orig_decl), type);
+      decl = build_decl (DECL_SOURCE_LOCATION (orig_decl),
+			 TREE_CODE (orig_decl), DECL_NAME (orig_decl), type);
       TREE_CONSTANT (decl) = TREE_CONSTANT (orig_decl);
       TREE_READONLY (decl) = TREE_READONLY (orig_decl);
       DECL_ARTIFICIAL (decl) = 1;
@@ -3022,7 +3024,8 @@ process_template_parm (tree list, tree p
       /* A template parameter is not modifiable.  */
       TREE_CONSTANT (parm) = 1;
       TREE_READONLY (parm) = 1;
-      decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm));
+      decl = build_decl (DECL_SOURCE_LOCATION (parm),
+			 CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm));
       TREE_CONSTANT (decl) = 1;
       TREE_READONLY (decl) = 1;
       DECL_INITIAL (parm) = DECL_INITIAL (decl)
@@ -3051,7 +3054,8 @@ process_template_parm (tree list, tree p
 	{
 	  t = cxx_make_type (TEMPLATE_TYPE_PARM);
 	  /* parm is either IDENTIFIER_NODE or NULL_TREE.  */
-	  decl = build_decl (TYPE_DECL, parm, t);
+	  decl = build_decl (input_location,
+			     TYPE_DECL, parm, t);
 	}
 
       TYPE_NAME (t) = decl;
@@ -7925,7 +7929,8 @@ tsubst_decl (tree t, tree args, tsubst_f
 	    TREE_CHAIN (r) = NULL_TREE;
 	    TREE_TYPE (r) = new_type;
 	    DECL_TEMPLATE_RESULT (r)
-	      = build_decl (TYPE_DECL, DECL_NAME (decl), new_type);
+	      = build_decl (DECL_SOURCE_LOCATION (decl),
+			    TYPE_DECL, DECL_NAME (decl), new_type);
 	    DECL_TEMPLATE_PARMS (r)
 	      = tsubst_template_parms (DECL_TEMPLATE_PARMS (t), args,
 				       complain);
@@ -10652,7 +10657,8 @@ tsubst_expr (tree t, tree args, tsubst_f
       break;
 
     case CASE_LABEL_EXPR:
-      finish_case_label (RECUR (CASE_LOW (t)),
+      finish_case_label (EXPR_LOCATION (t),
+			 RECUR (CASE_LOW (t)),
 			 RECUR (CASE_HIGH (t)));
       break;
 
@@ -16723,7 +16729,8 @@ make_auto (void)
 
   /* ??? Is it worth caching this for multiple autos at the same level?  */
   au = cxx_make_type (TEMPLATE_TYPE_PARM);
-  TYPE_NAME (au) = build_decl (TYPE_DECL, get_identifier ("auto"), au);
+  TYPE_NAME (au) = build_decl (BUILTINS_LOCATION,
+			       TYPE_DECL, get_identifier ("auto"), au);
   TYPE_STUB_DECL (au) = TYPE_NAME (au);
   TEMPLATE_TYPE_PARM_INDEX (au) = build_template_parm_index
     (0, processing_template_decl + 1, processing_template_decl + 1,
Index: cp/semantics.c
===================================================================
--- cp/semantics.c	(revision 141983)
+++ cp/semantics.c	(working copy)
@@ -1946,7 +1946,7 @@ finish_call_expr (tree fn, tree args, bo
       if (TREE_CODE (fn) == FUNCTION_DECL
 	  && (DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
 	      || DECL_BUILT_IN_CLASS (fn) == BUILT_IN_MD))
-	result = resolve_overloaded_builtin (fn, args);
+	result = resolve_overloaded_builtin (input_location, fn, args);
 
       if (!result)
 	/* A call to a namespace-scope function.  */
@@ -2207,7 +2207,8 @@ finish_template_type_parm (tree aggr, tr
 tree
 finish_template_template_parm (tree aggr, tree identifier)
 {
-  tree decl = build_decl (TYPE_DECL, identifier, NULL_TREE);
+  tree decl = build_decl (input_location,
+			  TYPE_DECL, identifier, NULL_TREE);
   tree tmpl = build_lang_decl (TEMPLATE_DECL, identifier, NULL_TREE);
   DECL_TEMPLATE_PARMS (tmpl) = current_template_parms;
   DECL_TEMPLATE_RESULT (tmpl) = decl;
Index: cp/lex.c
===================================================================
--- cp/lex.c	(revision 141983)
+++ cp/lex.c	(working copy)
@@ -451,7 +451,8 @@ unqualified_name_lookup_error (tree name
       if (current_function_decl)
 	{
 	  tree decl;
-	  decl = build_decl (VAR_DECL, name, error_mark_node);
+	  decl = build_decl (input_location,
+			     VAR_DECL, name, error_mark_node);
 	  DECL_CONTEXT (decl) = current_function_decl;
 	  push_local_binding (name, decl, 0);
 	  /* Mark the variable as used so that we do not get warnings
@@ -508,7 +509,8 @@ build_lang_decl (enum tree_code code, tr
 {
   tree t;
 
-  t = build_decl (code, name, type);
+  t = build_decl (input_location,
+		  code, name, type);
   retrofit_lang_decl (t);
 
   /* All nesting of C++ functions is lexical; there is never a "static
Index: cp/decl2.c
===================================================================
--- cp/decl2.c	(revision 141983)
+++ cp/decl2.c	(working copy)
@@ -132,7 +132,8 @@ build_memfn_type (tree fntype, tree ctyp
 tree
 cp_build_parm_decl (tree name, tree type)
 {
-  tree parm = build_decl (PARM_DECL, name, type);
+  tree parm = build_decl (input_location,
+			  PARM_DECL, name, type);
   /* DECL_ARG_TYPE is only used by the back end and the back end never
      sees templates.  */
   if (!processing_template_decl)
@@ -1282,7 +1283,8 @@ build_anon_union_vars (tree type, tree o
 	{
 	  tree base;
 
-	  decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field));
+	  decl = build_decl (input_location,
+			     VAR_DECL, DECL_NAME (field), TREE_TYPE (field));
 	  DECL_ANON_UNION_VAR_P (decl) = 1;
 
 	  base = get_base_address (object);
@@ -2471,7 +2473,8 @@ get_guard (tree decl)
       /* We use a type that is big enough to contain a mutex as well
 	 as an integer counter.  */
       guard_type = targetm.cxx.guard_type ();
-      guard = build_decl (VAR_DECL, sname, guard_type);
+      guard = build_decl (DECL_SOURCE_LOCATION (decl),
+			  VAR_DECL, sname, guard_type);
 
       /* The guard should have the same linkage as what it guards.  */
       TREE_PUBLIC (guard) = TREE_PUBLIC (decl);
Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 141983)
+++ cp/parser.c	(working copy)
@@ -7011,7 +7011,7 @@ cp_parser_label_for_labeled_statement (c
 	  expr_hi = NULL_TREE;
 
 	if (parser->in_switch_statement_p)
-	  finish_case_label (expr, expr_hi);
+	  finish_case_label (token->location, expr, expr_hi);
 	else
 	  error ("%Hcase label %qE not within a switch statement",
 		 &token->location, expr);
@@ -7023,7 +7023,7 @@ cp_parser_label_for_labeled_statement (c
       cp_lexer_consume_token (parser->lexer);
 
       if (parser->in_switch_statement_p)
-	finish_case_label (NULL_TREE, NULL_TREE);
+	finish_case_label (token->location, NULL_TREE, NULL_TREE);
       else
 	error ("%Hcase label not within a switch statement", &token->location);
       break;
@@ -15672,7 +15672,8 @@ cp_parser_member_declaration (cp_parser*
 		 know it is an anonymous aggregate.  */
 	      fixup_anonymous_aggr (type);
 	      /* And make the corresponding data member.  */
-	      decl = build_decl (FIELD_DECL, NULL_TREE, type);
+	      decl = build_decl (decl_spec_token_start->location,
+				 FIELD_DECL, NULL_TREE, type);
 	      /* Add it to the class.  */
 	      finish_member_declaration (decl);
 	    }
Index: tree-call-cdce.c
===================================================================
--- tree-call-cdce.c	(revision 141983)
+++ tree-call-cdce.c	(working copy)
@@ -779,7 +779,7 @@ shrink_wrap_one_built_in_call (gimple bi
   gcc_assert (cond_expr && gimple_code (cond_expr) == GIMPLE_COND);
 
   /* Now the label.  */
-  bi_call_label_decl = create_artificial_label ();
+  bi_call_label_decl = create_artificial_label (gimple_location (bi_call));
   bi_call_label = gimple_build_label (bi_call_label_decl);
   gsi_insert_before (&bi_call_bsi, bi_call_label, GSI_SAME_STMT);
 
Index: tree-ssa-alias.c
===================================================================
--- tree-ssa-alias.c	(revision 141983)
+++ tree-ssa-alias.c	(working copy)
@@ -3227,7 +3227,8 @@ create_tag_raw (enum tree_code code, tre
 {
   tree tmp_var;
 
-  tmp_var = build_decl (code, create_tmp_var_name (prefix), type);
+  tmp_var = build_decl (UNKNOWN_LOCATION,
+			code, create_tmp_var_name (prefix), type);
 
   /* Memory tags are always writable and non-static.  */
   TREE_READONLY (tmp_var) = 0;
@@ -3362,7 +3363,8 @@ get_smt_for (tree ptr, struct alias_info
 static void
 create_global_var (void)
 {
-  tree global_var = build_decl (VAR_DECL, get_identifier (".GLOBAL_VAR"),
+  tree global_var = build_decl (UNKNOWN_LOCATION,
+				VAR_DECL, get_identifier (".GLOBAL_VAR"),
                                 void_type_node);
   DECL_ARTIFICIAL (global_var) = 1;
   TREE_READONLY (global_var) = 0;
Index: gimple-low.c
===================================================================
--- gimple-low.c	(revision 141983)
+++ gimple-low.c	(working copy)
@@ -168,7 +168,7 @@ lower_function_body (void)
       tree disp_label, disp_var, arg;
 
       /* Build 'DISP_LABEL:' and insert.  */
-      disp_label = create_artificial_label ();
+      disp_label = create_artificial_label (cfun->function_end_locus);
       /* This mark will create forward edges from every call site.  */
       DECL_NONLOCAL (disp_label) = 1;
       cfun->has_nonlocal_label = 1;
@@ -652,7 +652,7 @@ lower_gimple_return (gimple_stmt_iterato
     }
 
   /* Not found.  Create a new label and record the return statement.  */
-  tmp_rs.label = create_artificial_label ();
+  tmp_rs.label = create_artificial_label (cfun->function_end_locus);
   tmp_rs.stmt = stmt;
   VEC_safe_push (return_statements_t, heap, data->return_statements, &tmp_rs);
 
@@ -722,8 +722,8 @@ static void
 lower_builtin_setjmp (gimple_stmt_iterator *gsi)
 {
   gimple stmt = gsi_stmt (*gsi);
-  tree cont_label = create_artificial_label ();
-  tree next_label = create_artificial_label ();
+  tree cont_label = create_artificial_label (UNKNOWN_LOCATION);
+  tree next_label = create_artificial_label (UNKNOWN_LOCATION);
   tree dest, t, arg;
   gimple g;
 
Index: c-tree.h
===================================================================
--- c-tree.h	(revision 141983)
+++ c-tree.h	(working copy)
@@ -462,7 +462,7 @@ extern void c_print_identifier (FILE *, 
 extern int quals_from_declspecs (const struct c_declspecs *);
 extern struct c_declarator *build_array_declarator (tree, struct c_declspecs *,
 						    bool, bool);
-extern tree build_enumerator (struct c_enum_contents *, tree, tree, location_t);
+extern tree build_enumerator (location_t, struct c_enum_contents *, tree, tree);
 extern tree check_for_loop_decls (void);
 extern void mark_forward_parm_decls (void);
 extern void declare_parm_level (void);
@@ -473,13 +473,13 @@ extern void c_maybe_initialize_eh (void)
 extern void finish_decl (tree, tree, tree);
 extern tree finish_enum (tree, tree, tree);
 extern void finish_function (void);
-extern tree finish_struct (tree, tree, tree);
+extern tree finish_struct (location_t, tree, tree, tree);
 extern struct c_arg_info *get_parm_info (bool);
 extern tree grokfield (location_t, struct c_declarator *,
 		       struct c_declspecs *, tree, tree *);
 extern tree groktypename (struct c_type_name *);
 extern tree grokparm (const struct c_parm *);
-extern tree implicitly_declare (tree);
+extern tree implicitly_declare (location_t, tree);
 extern void keep_next_level (void);
 extern void pending_xref_error (void);
 extern void c_push_function_context (void);
@@ -491,15 +491,15 @@ extern tree c_builtin_function (tree);
 extern tree c_builtin_function_ext_scope (tree);
 extern void shadow_tag (const struct c_declspecs *);
 extern void shadow_tag_warned (const struct c_declspecs *, int);
-extern tree start_enum (struct c_enum_contents *, tree);
+extern tree start_enum (location_t, struct c_enum_contents *, tree);
 extern int  start_function (struct c_declspecs *, struct c_declarator *, tree);
 extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool,
 			tree);
-extern tree start_struct (enum tree_code, tree);
+extern tree start_struct (location_t, enum tree_code, tree);
 extern void store_parm_decls (void);
 extern void store_parm_decls_from (struct c_arg_info *);
 extern tree xref_tag (enum tree_code, tree);
-extern struct c_typespec parser_xref_tag (enum tree_code, tree);
+extern struct c_typespec parser_xref_tag (location_t, enum tree_code, tree);
 extern int c_expand_decl (tree);
 extern struct c_parm *build_c_parm (struct c_declspecs *, tree,
 				    struct c_declarator *);
@@ -576,7 +576,7 @@ extern struct c_expr pop_init_level (int
 extern void set_init_index (tree, tree);
 extern void set_init_label (tree);
 extern void process_init_element (struct c_expr);
-extern tree build_compound_literal (tree, tree);
+extern tree build_compound_literal (location_t, tree, tree);
 extern tree c_start_case (tree);
 extern void c_finish_case (tree);
 extern tree build_asm_expr (tree, tree, tree, tree, bool);
@@ -591,7 +591,7 @@ extern tree c_finish_stmt_expr (tree);
 extern tree c_process_expr_stmt (tree);
 extern tree c_finish_expr_stmt (tree);
 extern tree c_finish_return (tree);
-extern tree c_finish_bc_stmt (tree *, bool);
+extern tree c_finish_bc_stmt (location_t, tree *, bool);
 extern tree c_finish_goto_label (tree);
 extern tree c_finish_goto_ptr (tree);
 extern void c_begin_vm_scope (unsigned int);
Index: expr.c
===================================================================
--- expr.c	(revision 141983)
+++ expr.c	(working copy)
@@ -1442,7 +1442,7 @@ init_block_move_fn (const char *asmspec)
 				       const_ptr_type_node, sizetype,
 				       NULL_TREE);
 
-      fn = build_decl (FUNCTION_DECL, fn, args);
+      fn = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, fn, args);
       DECL_EXTERNAL (fn) = 1;
       TREE_PUBLIC (fn) = 1;
       DECL_ARTIFICIAL (fn) = 1;
@@ -2712,7 +2712,7 @@ init_block_clear_fn (const char *asmspec
 				       integer_type_node, sizetype,
 				       NULL_TREE);
 
-      fn = build_decl (FUNCTION_DECL, fn, args);
+      fn = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, fn, args);
       DECL_EXTERNAL (fn) = 1;
       TREE_PUBLIC (fn) = 1;
       DECL_ARTIFICIAL (fn) = 1;
@@ -5465,7 +5465,8 @@ store_constructor (tree exp, rtx target,
 		    expand_normal (hi_index);
 		    unsignedp = TYPE_UNSIGNED (domain);
 
-		    index = build_decl (VAR_DECL, NULL_TREE, domain);
+		    index = build_decl (EXPR_LOCATION (exp),
+					VAR_DECL, NULL_TREE, domain);
 
 		    index_r
 		      = gen_reg_rtx (promote_mode (domain, DECL_MODE (index),
@@ -7470,7 +7471,8 @@ expand_expr_real_1 (tree exp, rtx target
 	       with non-BLKmode values.  */
 	    gcc_assert (GET_MODE (ret) != BLKmode);
 
-	    val = build_decl (VAR_DECL, NULL, TREE_TYPE (exp));
+	    val = build_decl (EXPR_LOCATION (exp),
+			      VAR_DECL, NULL, TREE_TYPE (exp));
 	    DECL_ARTIFICIAL (val) = 1;
 	    DECL_IGNORED_P (val) = 1;
 	    TREE_OPERAND (exp, 0) = val;
Index: tree-parloops.c
===================================================================
--- tree-parloops.c	(revision 141983)
+++ tree-parloops.c	(working copy)
@@ -852,7 +852,8 @@ add_field_for_reduction (void **slot, vo
   struct reduction_info *const red = (struct reduction_info *) *slot;
   tree const type = (tree) data;
   tree var = SSA_NAME_VAR (gimple_assign_lhs (red->reduc_stmt));
-  tree field = build_decl (FIELD_DECL, DECL_NAME (var), TREE_TYPE (var));
+  tree field = build_decl (gimple_location (red->reduc_stmt),
+			   FIELD_DECL, DECL_NAME (var), TREE_TYPE (var));
 
   insert_field_into_struct (type, field);
 
@@ -871,7 +872,8 @@ add_field_for_name (void **slot, void *d
   tree type = (tree) data;
   tree name = ssa_name (elt->version);
   tree var = SSA_NAME_VAR (name);
-  tree field = build_decl (FIELD_DECL, DECL_NAME (var), TREE_TYPE (var));
+  tree field = build_decl (DECL_SOURCE_LOCATION (var),
+			   FIELD_DECL, DECL_NAME (var), TREE_TYPE (var));
 
   insert_field_into_struct (type, field);
   elt->field = field;
@@ -1204,7 +1206,8 @@ separate_decls_in_region (edge entry, ed
     {
       /* Create the type for the structure to store the ssa names to.  */
       type = lang_hooks.types.make_type (RECORD_TYPE);
-      type_name = build_decl (TYPE_DECL, create_tmp_var_name (".paral_data"),
+      type_name = build_decl (input_location,
+			      TYPE_DECL, create_tmp_var_name (".paral_data"),
 			      type);
       TYPE_NAME (type) = type_name;
 
@@ -1284,7 +1287,8 @@ create_loop_fn (void)
   name = get_identifier (tname);
   type = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
 
-  decl = build_decl (FUNCTION_DECL, name, type);
+  decl = build_decl (input_location,
+		     FUNCTION_DECL, name, type);
   if (!parallelized_functions)
     parallelized_functions = BITMAP_GGC_ALLOC ();
   bitmap_set_bit (parallelized_functions, DECL_UID (decl));
@@ -1299,12 +1303,14 @@ create_loop_fn (void)
   DECL_CONTEXT (decl) = NULL_TREE;
   DECL_INITIAL (decl) = make_node (BLOCK);
 
-  t = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
+  t = build_decl (input_location,
+		  RESULT_DECL, NULL_TREE, void_type_node);
   DECL_ARTIFICIAL (t) = 1;
   DECL_IGNORED_P (t) = 1;
   DECL_RESULT (decl) = t;
 
-  t = build_decl (PARM_DECL, get_identifier (".paral_data_param"),
+  t = build_decl (input_location,
+		  PARM_DECL, get_identifier (".paral_data_param"),
 		  ptr_type_node);
   DECL_ARTIFICIAL (t) = 1;
   DECL_ARG_TYPE (t) = ptr_type_node;
Index: c-decl.c
===================================================================
--- c-decl.c	(revision 141983)
+++ c-decl.c	(working copy)
@@ -407,7 +407,7 @@ static bool next_is_function_body;
 
 /* Forward declarations.  */
 static tree lookup_name_in_scope (tree, struct c_scope *);
-static tree c_make_fname_decl (tree, int);
+static tree c_make_fname_decl (location_t, tree, int);
 static tree grokdeclarator (const struct c_declarator *,
 			    struct c_declspecs *,
 			    enum decl_context, bool, tree *, tree *,
@@ -719,7 +719,8 @@ pop_scope (void)
     context = current_function_decl;
   else if (scope == file_scope)
     {
-      tree file_decl = build_decl (TRANSLATION_UNIT_DECL, 0, 0);
+      tree file_decl = build_decl (UNKNOWN_LOCATION,
+	  			   TRANSLATION_UNIT_DECL, 0, 0);
       TREE_CHAIN (file_decl) = all_translation_units;
       all_translation_units = file_decl;
       context = file_decl;
@@ -936,13 +937,14 @@ pop_file_scope (void)
 
 /* Push a definition or a declaration of struct, union or enum tag "name".
    "type" should be the type node.
-   We assume that the tag "name" is not already defined.
+   We assume that the tag "name" is not already defined, and has a location
+   of LOC.
 
    Note that the definition may really be just a forward reference.
    In that case, the TYPE_SIZE will be zero.  */
 
 static void
-pushtag (tree name, tree type)
+pushtag (location_t loc, tree name, tree type)
 {
   /* Record the identifier as the type's name if it has none.  */
   if (name && !TYPE_NAME (type))
@@ -956,7 +958,8 @@ pushtag (tree name, tree type)
      us a convenient place to record the "scope start" address for the
      tagged type.  */
 
-  TYPE_STUB_DECL (type) = pushdecl (build_decl (TYPE_DECL, NULL_TREE, type));
+  TYPE_STUB_DECL (type) = pushdecl (build_decl (loc,
+						TYPE_DECL, NULL_TREE, type));
 
   /* An approximation for now, so we can tell this is a function-scope tag.
      This will be updated in pop_scope.  */
@@ -2332,11 +2335,11 @@ implicit_decl_warning (tree id, tree old
     }
 }
 
-/* Generate an implicit declaration for identifier FUNCTIONID as a
+/* Generate an implicit declaration for identifier FUNCTIONID at LOC as a
    function of type int ().  */
 
 tree
-implicitly_declare (tree functionid)
+implicitly_declare (location_t loc, tree functionid)
 {
   struct c_binding *b;
   tree decl = 0;
@@ -2388,8 +2391,8 @@ implicitly_declare (tree functionid)
 						      (TREE_TYPE (decl)));
 	      if (!comptypes (newtype, TREE_TYPE (decl)))
 		{
-		  warning (0, "incompatible implicit declaration of built-in"
-			   " function %qD", decl);
+		  warning_at (loc, 0, "incompatible implicit declaration of "
+			      "built-in function %qD", decl);
 		  newtype = TREE_TYPE (decl);
 		}
 	    }
@@ -2397,8 +2400,7 @@ implicitly_declare (tree functionid)
 	    {
 	      if (!comptypes (newtype, TREE_TYPE (decl)))
 		{
-		  error ("incompatible implicit declaration of function %qD",
-			 decl);
+		  error_at (loc, "incompatible implicit declaration of function %qD", decl);
 		  locate_old_decl (decl);
 		}
 	    }
@@ -2411,7 +2413,7 @@ implicitly_declare (tree functionid)
     }
 
   /* Not seen before.  */
-  decl = build_decl (FUNCTION_DECL, functionid, default_function_type);
+  decl = build_decl (loc, FUNCTION_DECL, functionid, default_function_type);
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 1;
   C_DECL_IMPLICIT (decl) = 1;
@@ -2477,11 +2479,10 @@ undeclared_variable (tree id, location_t
 static tree
 make_label (tree name, location_t location)
 {
-  tree label = build_decl (LABEL_DECL, name, void_type_node);
+  tree label = build_decl (location, LABEL_DECL, name, void_type_node);
 
   DECL_CONTEXT (label) = current_function_decl;
   DECL_MODE (label) = VOIDmode;
-  DECL_SOURCE_LOCATION (label) = location;
 
   return label;
 }
@@ -2747,7 +2748,7 @@ c_init_decl_processing (void)
   truthvalue_false_node = integer_zero_node;
 
   /* Even in C99, which has a real boolean type.  */
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("_Bool"),
+  pushdecl (build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier ("_Bool"),
 			boolean_type_node));
 
   input_location = save_loc;
@@ -2758,15 +2759,16 @@ c_init_decl_processing (void)
   start_fname_decls ();
 }
 
-/* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give the
-   decl, NAME is the initialization string and TYPE_DEP indicates whether
-   NAME depended on the type of the function.  As we don't yet implement
-   delayed emission of static data, we mark the decl as emitted
-   so it is not placed in the output.  Anything using it must therefore pull
-   out the STRING_CST initializer directly.  FIXME.  */
+/* Create the VAR_DECL at LOC for __FUNCTION__ etc. ID is the name to
+   give the decl, NAME is the initialization string and TYPE_DEP
+   indicates whether NAME depended on the type of the function.  As we
+   don't yet implement delayed emission of static data, we mark the
+   decl as emitted so it is not placed in the output.  Anything using
+   it must therefore pull out the STRING_CST initializer directly.
+   FIXME.  */
 
 static tree
-c_make_fname_decl (tree id, int type_dep)
+c_make_fname_decl (location_t loc, tree id, int type_dep)
 {
   const char *name = fname_as_string (type_dep);
   tree decl, type, init;
@@ -2776,7 +2778,7 @@ c_make_fname_decl (tree id, int type_dep
 			   build_index_type (size_int (length)));
   type = c_build_qualified_type (type, TYPE_QUAL_CONST);
 
-  decl = build_decl (VAR_DECL, id, type);
+  decl = build_decl (loc, VAR_DECL, id, type);
 
   TREE_STATIC (decl) = 1;
   TREE_READONLY (decl) = 1;
@@ -2935,7 +2937,7 @@ shadow_tag_warned (const struct c_declsp
 	      if (t == 0)
 		{
 		  t = make_node (code);
-		  pushtag (name, t);
+		  pushtag (input_location, name, t);
 		}
 	    }
 	}
@@ -3643,7 +3645,8 @@ finish_decl (tree decl, tree init, tree 
 	  /* Build "cleanup(&decl)" for the destructor.  */
 	  cleanup = build_unary_op (input_location, ADDR_EXPR, decl, 0);
 	  cleanup = build_tree_list (NULL_TREE, cleanup);
-	  cleanup = build_function_call (cleanup_decl, cleanup);
+	  cleanup = build_function_call (DECL_SOURCE_LOCATION (decl),
+	      				 cleanup_decl, cleanup);
 
 	  /* Don't warn about decl unused; the cleanup uses it.  */
 	  TREE_USED (decl) = 1;
@@ -3711,11 +3714,11 @@ mark_forward_parm_decls (void)
 
 /* Build a COMPOUND_LITERAL_EXPR.  TYPE is the type given in the compound
    literal, which may be an incomplete array type completed by the
-   initializer; INIT is a CONSTRUCTOR that initializes the compound
+   initializer; INIT is a CONSTRUCTOR at LOC that initializes the compound
    literal.  */
 
 tree
-build_compound_literal (tree type, tree init)
+build_compound_literal (location_t loc, tree type, tree init)
 {
   /* We do not use start_decl here because we have a type, not a declarator;
      and do not use finish_decl because the decl should be stored inside
@@ -3727,7 +3730,7 @@ build_compound_literal (tree type, tree 
   if (type == error_mark_node)
     return error_mark_node;
 
-  decl = build_decl (VAR_DECL, NULL_TREE, type);
+  decl = build_decl (loc, VAR_DECL, NULL_TREE, type);
   DECL_EXTERNAL (decl) = 0;
   TREE_PUBLIC (decl) = 0;
   TREE_STATIC (decl) = (current_scope == file_scope);
@@ -3990,6 +3993,7 @@ grokdeclarator (const struct c_declarato
   bool bitfield = width != NULL;
   tree element_type;
   struct c_arg_info *arg_info = 0;
+  location_t loc = UNKNOWN_LOCATION;
 
   if (decl_context == FUNCDEF)
     funcdef_flag = true, decl_context = NORMAL;
@@ -4015,6 +4019,7 @@ grokdeclarator (const struct c_declarato
 	  break;
 
 	case cdk_id:
+	  loc = decl->id_loc;
 	  if (decl->u.id)
 	    name = IDENTIFIER_POINTER (decl->u.id);
 	  decl = 0;
@@ -4047,7 +4052,7 @@ grokdeclarator (const struct c_declarato
       && current_scope == file_scope
       && variably_modified_type_p (type, NULL_TREE))
     {
-      error ("variably modified %qs at file scope", name);
+      error_at (loc, "variably modified %qs at file scope", name);
       type = integer_type_node;
     }
 
@@ -4064,7 +4069,7 @@ grokdeclarator (const struct c_declarato
 	  && funcdef_flag)
 	warn_about_return_type = 1;
       else 
-	pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int, 
+	pedwarn_c99 (loc, flag_isoc99 ? 0 : OPT_Wimplicit_int, 
 		     "type defaults to %<int%> in declaration of %qs", name);
     }
 
@@ -4093,11 +4098,11 @@ grokdeclarator (const struct c_declarato
   if (pedantic && !flag_isoc99)
     {
       if (constp > 1)
-	pedwarn (input_location, OPT_pedantic, "duplicate %<const%>");
+	pedwarn (loc, OPT_pedantic, "duplicate %<const%>");
       if (restrictp > 1)
-	pedwarn (input_location, OPT_pedantic, "duplicate %<restrict%>");
+	pedwarn (loc, OPT_pedantic, "duplicate %<restrict%>");
       if (volatilep > 1)
-	pedwarn (input_location, OPT_pedantic, "duplicate %<volatile%>");
+	pedwarn (loc, OPT_pedantic, "duplicate %<volatile%>");
     }
   if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
     type = TYPE_MAIN_VARIANT (type);
@@ -4115,15 +4120,15 @@ grokdeclarator (const struct c_declarato
 	  || storage_class == csc_typedef))
     {
       if (storage_class == csc_auto)
-	pedwarn (input_location, 
+	pedwarn (loc, 
 		 (current_scope == file_scope) ? 0 : OPT_pedantic, 
 		 "function definition declared %<auto%>");
       if (storage_class == csc_register)
-	error ("function definition declared %<register%>");
+	error_at (loc, "function definition declared %<register%>");
       if (storage_class == csc_typedef)
-	error ("function definition declared %<typedef%>");
+	error_at (loc, "function definition declared %<typedef%>");
       if (threadp)
-	error ("function definition declared %<__thread%>");
+	error_at (loc, "function definition declared %<__thread%>");
       threadp = false;
       if (storage_class == csc_auto
 	  || storage_class == csc_register
@@ -4139,14 +4144,15 @@ grokdeclarator (const struct c_declarato
 	  switch (decl_context)
 	    {
 	    case FIELD:
-	      error ("storage class specified for structure field %qs",
+	      error_at (loc, "storage class specified for structure field %qs",
 		     name);
 	      break;
 	    case PARM:
-	      error ("storage class specified for parameter %qs", name);
+	      error_at (loc, "storage class specified for parameter %qs",
+			name);
 	      break;
 	    default:
-	      error ("storage class specified for typename");
+	      error_at (loc, "storage class specified for typename");
 	      break;
 	    }
 	  storage_class = csc_none;
@@ -4163,15 +4169,17 @@ grokdeclarator (const struct c_declarato
            /* It is fine to have 'extern const' when compiling at C
               and C++ intersection.  */
            if (!(warn_cxx_compat && constp))
-             warning (0, "%qs initialized and declared %<extern%>", name);
+             warning_at (loc, 0, "%qs initialized and declared %<extern%>",
+			 name);
          }
       else
-	error ("%qs has both %<extern%> and initializer", name);
+	error_at (loc, "%qs has both %<extern%> and initializer", name);
     }
   else if (current_scope == file_scope)
     {
       if (storage_class == csc_auto)
-	error ("file-scope declaration of %qs specifies %<auto%>", name);
+	error_at (loc, "file-scope declaration of %qs specifies %<auto%>",
+		  name);
       if (pedantic && storage_class == csc_register)
 	pedwarn (input_location, OPT_pedantic,
 		 "file-scope declaration of %qs specifies %<register%>", name);
@@ -4179,10 +4187,10 @@ grokdeclarator (const struct c_declarato
   else
     {
       if (storage_class == csc_extern && funcdef_flag)
-	error ("nested function %qs declared %<extern%>", name);
+	error_at (loc, "nested function %qs declared %<extern%>", name);
       else if (threadp && storage_class == csc_none)
 	{
-	  error ("function-scope %qs implicitly auto and declared "
+	  error_at (loc, "function-scope %qs implicitly auto and declared "
 		 "%<__thread%>",
 		 name);
 	  threadp = false;
@@ -4229,7 +4237,7 @@ grokdeclarator (const struct c_declarato
 	  /* Only the innermost declarator (making a parameter be of
 	     array type which is converted to pointer type)
 	     may have static or type qualifiers.  */
-	  error ("static or type qualifiers in non-parameter array declarator");
+	  error_at (loc, "static or type qualifiers in non-parameter array declarator");
 	  array_ptr_quals = TYPE_UNQUALIFIED;
 	  array_ptr_attrs = NULL_TREE;
 	  array_parm_static = 0;
@@ -4276,18 +4284,19 @@ grokdeclarator (const struct c_declarato
 
 	    if (VOID_TYPE_P (type))
 	      {
-		error ("declaration of %qs as array of voids", name);
+		error_at (loc, "declaration of %qs as array of voids", name);
 		type = error_mark_node;
 	      }
 
 	    if (TREE_CODE (type) == FUNCTION_TYPE)
 	      {
-		error ("declaration of %qs as array of functions", name);
+		error_at (loc, "declaration of %qs as array of functions",
+			  name);
 		type = error_mark_node;
 	      }
 
 	    if (pedantic && !in_system_header && flexible_array_type_p (type))
-	      pedwarn (input_location, OPT_pedantic,
+	      pedwarn (loc, OPT_pedantic,
 		       "invalid use of structure with flexible array member");
 
 	    if (size == error_mark_node)
@@ -4308,12 +4317,13 @@ grokdeclarator (const struct c_declarato
 
 		if (!INTEGRAL_TYPE_P (TREE_TYPE (size)))
 		  {
-		    error ("size of array %qs has non-integer type", name);
+		    error_at (loc, "size of array %qs has non-integer type",
+			      name);
 		    size = integer_one_node;
 		  }
 
 		if (pedantic && integer_zerop (size))
-		  pedwarn (input_location, OPT_pedantic,
+		  pedwarn (loc, OPT_pedantic,
 			   "ISO C forbids zero-size array %qs", name);
 
 		if (TREE_CODE (size) == INTEGER_CST)
@@ -4321,14 +4331,15 @@ grokdeclarator (const struct c_declarato
 		    constant_expression_warning (size);
 		    if (tree_int_cst_sgn (size) < 0)
 		      {
-			error ("size of array %qs is negative", name);
+			error_at (loc, "size of array %qs is negative", name);
 			size = integer_one_node;
 		      }
 		  }
 		else if ((decl_context == NORMAL || decl_context == FIELD)
 			 && current_scope == file_scope)
 		  {
-		    error ("variably modified %qs at file scope", name);
+		    error_at (loc, "variably modified %qs at file scope",
+			      name);
 		    size = integer_one_node;
 		  }
 		else
@@ -4375,7 +4386,7 @@ grokdeclarator (const struct c_declarato
 		    if (TREE_CODE (itype) == INTEGER_CST
 			&& TREE_OVERFLOW (itype))
 		      {
-			error ("size of array %qs is too large", name);
+			error_at (loc, "size of array %qs is too large", name);
 			type = error_mark_node;
 			continue;
 		      }
@@ -4386,7 +4397,7 @@ grokdeclarator (const struct c_declarato
 	    else if (decl_context == FIELD)
 	      {
 		if (pedantic && !flag_isoc99 && !in_system_header)
-		  pedwarn (input_location, OPT_pedantic,
+		  pedwarn (loc, OPT_pedantic,
 			   "ISO C90 does not support flexible array members");
 
 		/* ISO C99 Flexible array members are effectively
@@ -4400,7 +4411,7 @@ grokdeclarator (const struct c_declarato
 		    if (! orig_name)
 		      {
 			/* C99 6.7.5.2p4 */
-			error ("%<[*]%> not allowed in other than a declaration");
+			error_at (loc, "%<[*]%> not allowed in other than a declaration");
 		      }
 
 		    itype = build_range_type (sizetype, size_zero_node, NULL_TREE);
@@ -4423,7 +4434,7 @@ grokdeclarator (const struct c_declarato
 	     /* Complain about arrays of incomplete types.  */
 	    if (!COMPLETE_TYPE_P (type))
 	      {
-		error ("array type has incomplete element type");
+		error_at (loc, "array type has incomplete element type");
 		type = error_mark_node;
 	      }
 	    else
@@ -4473,7 +4484,7 @@ grokdeclarator (const struct c_declarato
 		    || array_ptr_attrs != NULL_TREE
 		    || array_parm_static))
 	      {
-		error ("static or type qualifiers in non-parameter array declarator");
+		error_at (loc, "static or type qualifiers in non-parameter array declarator");
 		array_ptr_quals = TYPE_UNQUALIFIED;
 		array_ptr_attrs = NULL_TREE;
 		array_parm_static = 0;
@@ -4505,12 +4516,14 @@ grokdeclarator (const struct c_declarato
 	    /* Warn about some types functions can't return.  */
 	    if (TREE_CODE (type) == FUNCTION_TYPE)
 	      {
-		error ("%qs declared as function returning a function", name);
+		error_at (loc, "%qs declared as function returning a function",
+			  name);
 		type = integer_type_node;
 	      }
 	    if (TREE_CODE (type) == ARRAY_TYPE)
 	      {
-		error ("%qs declared as function returning an array", name);
+		error_at (loc, "%qs declared as function returning an array",
+			  name);
 		type = integer_type_node;
 	      }
 
@@ -4532,10 +4545,10 @@ grokdeclarator (const struct c_declarato
 		   function definitions in ISO C; GCC used to used
 		   them for noreturn functions.  */
 		if (VOID_TYPE_P (type) && really_funcdef)
-		  pedwarn (input_location, 0,
+		  pedwarn (loc, 0,
 			   "function definition has qualified void return type");
 		else
-		  warning (OPT_Wignored_qualifiers,
+		  warning_at (loc, OPT_Wignored_qualifiers,
 			   "type qualifiers ignored on function return type");
 
 		type = c_build_qualified_type (type, type_quals);
@@ -4565,7 +4578,7 @@ grokdeclarator (const struct c_declarato
 
 	    if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
 		&& type_quals)
-	      pedwarn (input_location, OPT_pedantic,
+	      pedwarn (loc, OPT_pedantic,
 		       "ISO C forbids qualified function types");
 	    if (type_quals)
 	      type = c_build_qualified_type (type, type_quals);
@@ -4598,7 +4611,7 @@ grokdeclarator (const struct c_declarato
 		&& (decl_context == NORMAL || decl_context == FIELD)
 		&& variably_modified_type_p (type, NULL_TREE))
 	      {
-		tree decl = build_decl (TYPE_DECL, NULL_TREE, type);
+		tree decl = build_decl (loc, TYPE_DECL, NULL_TREE, type);
 		DECL_ARTIFICIAL (decl) = 1;
 		pushdecl (decl);
 		finish_decl (decl, NULL_TREE, NULL_TREE);
@@ -4634,7 +4647,7 @@ grokdeclarator (const struct c_declarato
       && TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
       && TREE_OVERFLOW (TYPE_SIZE_UNIT (type)))
     {
-      error ("size of array %qs is too large", name);
+      error_at (loc, "size of array %qs is too large", name);
       /* If we proceed with the array type as it is, we'll eventually
 	 crash in tree_low_cst().  */
       type = error_mark_node;
@@ -4647,16 +4660,16 @@ grokdeclarator (const struct c_declarato
       tree decl;
       if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
 	  && type_quals)
-	pedwarn (input_location, OPT_pedantic,
+	pedwarn (loc, OPT_pedantic,
 		 "ISO C forbids qualified function types");
       if (type_quals)
 	type = c_build_qualified_type (type, type_quals);
-      decl = build_decl (TYPE_DECL, declarator->u.id, type);
-      DECL_SOURCE_LOCATION (decl) = declarator->id_loc;
+      decl = build_decl (declarator->id_loc,
+			 TYPE_DECL, declarator->u.id, type);
       if (declspecs->explicit_signed_p)
 	C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
       if (declspecs->inline_p)
-	pedwarn (input_location, 0,"typedef %q+D declared %<inline%>", decl);
+	pedwarn (loc, 0,"typedef %q+D declared %<inline%>", decl);
       return decl;
     }
 
@@ -4671,7 +4684,7 @@ grokdeclarator (const struct c_declarato
 		  && !declspecs->inline_p);
       if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
 	  && type_quals)
-	pedwarn (input_location, OPT_pedantic,
+	pedwarn (loc, OPT_pedantic,
 		 "ISO C forbids const or volatile function types");
       if (type_quals)
 	type = c_build_qualified_type (type, type_quals);
@@ -4682,7 +4695,7 @@ grokdeclarator (const struct c_declarato
       && variably_modified_type_p (type, NULL_TREE))
     {
       /* C99 6.7.2.1p8 */
-      pedwarn (input_location, OPT_pedantic, 
+      pedwarn (loc, OPT_pedantic, 
 	       "a member of a structure or union cannot have a variably modified type");
     }
 
@@ -4699,7 +4712,7 @@ grokdeclarator (const struct c_declarato
 		    && !(storage_class == csc_static
 			 || storage_class == csc_register)))))
     {
-      error ("variable or field %qs declared void", name);
+      error_at (loc, "variable or field %qs declared void", name);
       type = integer_type_node;
     }
 
@@ -4729,15 +4742,15 @@ grokdeclarator (const struct c_declarato
 
 	    /* We don't yet implement attributes in this context.  */
 	    if (array_ptr_attrs != NULL_TREE)
-	      warning (OPT_Wattributes,
-		       "attributes in parameter array declarator ignored");
+	      warning_at (loc, OPT_Wattributes,
+			  "attributes in parameter array declarator ignored");
 
 	    size_varies = 0;
 	  }
 	else if (TREE_CODE (type) == FUNCTION_TYPE)
 	  {
 	    if (type_quals)
-	      pedwarn (input_location, OPT_pedantic,
+	      pedwarn (loc, OPT_pedantic,
 		       "ISO C forbids qualified function types");
 	    if (type_quals)
 	      type = c_build_qualified_type (type, type_quals);
@@ -4747,8 +4760,8 @@ grokdeclarator (const struct c_declarato
 	else if (type_quals)
 	  type = c_build_qualified_type (type, type_quals);
 
-	decl = build_decl (PARM_DECL, declarator->u.id, type);
-	DECL_SOURCE_LOCATION (decl) = declarator->id_loc;
+	decl = build_decl (declarator->id_loc,
+			   PARM_DECL, declarator->u.id, type);
 	if (size_varies)
 	  C_DECL_VARIABLE_SIZE (decl) = 1;
 
@@ -4764,7 +4777,7 @@ grokdeclarator (const struct c_declarato
 
 	DECL_ARG_TYPE (decl) = promoted_type;
 	if (declspecs->inline_p)
-	  pedwarn (input_location, 0, "parameter %q+D declared %<inline%>", decl);
+	  pedwarn (loc, 0, "parameter %q+D declared %<inline%>", decl);
       }
     else if (decl_context == FIELD)
       {
@@ -4777,18 +4790,18 @@ grokdeclarator (const struct c_declarato
 
 	if (TREE_CODE (type) == FUNCTION_TYPE)
 	  {
-	    error ("field %qs declared as a function", name);
+	    error_at (loc, "field %qs declared as a function", name);
 	    type = build_pointer_type (type);
 	  }
 	else if (TREE_CODE (type) != ERROR_MARK
 		 && !COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (type))
 	  {
-	    error ("field %qs has incomplete type", name);
+	    error_at (loc, "field %qs has incomplete type", name);
 	    type = error_mark_node;
 	  }
 	type = c_build_qualified_type (type, type_quals);
-	decl = build_decl (FIELD_DECL, declarator->u.id, type);
-	DECL_SOURCE_LOCATION (decl) = declarator->id_loc;
+	decl = build_decl (declarator->id_loc,
+			   FIELD_DECL, declarator->u.id, type);
 	DECL_NONADDRESSABLE_P (decl) = bitfield;
 	if (bitfield && !declarator->u.id)
 	  TREE_NO_WARNING (decl) = 1;
@@ -4800,7 +4813,7 @@ grokdeclarator (const struct c_declarato
       {
 	if (storage_class == csc_register || threadp)
 	  {
-	    error ("invalid storage class for function %qs", name);
+	    error_at (loc, "invalid storage class for function %qs", name);
 	   }
 	else if (current_scope != file_scope)
 	  {
@@ -4810,10 +4823,10 @@ grokdeclarator (const struct c_declarato
 	       GCC allows 'auto', perhaps with 'inline', to support
 	       nested functions.  */
 	    if (storage_class == csc_auto)
-		pedwarn (input_location, OPT_pedantic, "invalid storage class for function %qs", name);
+		pedwarn (loc, OPT_pedantic, "invalid storage class for function %qs", name);
 	    else if (storage_class == csc_static)
 	      {
-		error ("invalid storage class for function %qs", name);
+		error_at (loc, "invalid storage class for function %qs", name);
 		if (funcdef_flag)
 		  storage_class = declspecs->storage_class = csc_none;
 		else
@@ -4821,19 +4834,19 @@ grokdeclarator (const struct c_declarato
 	      }
 	  }
 
-	decl = build_decl (FUNCTION_DECL, declarator->u.id, type);
-	DECL_SOURCE_LOCATION (decl) = declarator->id_loc;
+	decl = build_decl (declarator->id_loc,
+			   FUNCTION_DECL, declarator->u.id, type);
 	decl = build_decl_attribute_variant (decl, decl_attr);
 
 	if (pedantic && type_quals && !DECL_IN_SYSTEM_HEADER (decl))
-	  pedwarn (input_location, OPT_pedantic,
+	  pedwarn (loc, OPT_pedantic,
 		   "ISO C forbids qualified function types");
 
 	/* GNU C interprets a volatile-qualified function type to indicate
 	   that the function does not return.  */
 	if ((type_quals & TYPE_QUAL_VOLATILE)
 	    && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
-	  warning (0, "%<noreturn%> function returns non-void value");
+	  warning_at (loc, 0, "%<noreturn%> function returns non-void value");
 
 	/* Every function declaration is an external reference
 	   (DECL_EXTERNAL) except for those which are not at file
@@ -4869,7 +4882,7 @@ grokdeclarator (const struct c_declarato
 	if (flag_hosted && MAIN_NAME_P (declarator->u.id))
 	  {
 	    if (declspecs->inline_p)
-	      pedwarn (input_location, 0, "cannot inline function %<main%>");
+	      pedwarn (loc, 0, "cannot inline function %<main%>");
 	  }
 	else if (declspecs->inline_p)
 	  /* Record that the function is declared `inline'.  */
@@ -4898,17 +4911,17 @@ grokdeclarator (const struct c_declarato
 		&& global_decl != visible_decl
 		&& TREE_CODE (global_decl) == VAR_DECL
 		&& !TREE_PUBLIC (global_decl))
-	      error ("variable previously declared %<static%> redeclared "
-		     "%<extern%>");
+	      error_at (loc, "variable previously declared %<static%> "
+			"redeclared %<extern%>");
 	  }
 
-	decl = build_decl (VAR_DECL, declarator->u.id, type);
-	DECL_SOURCE_LOCATION (decl) = declarator->id_loc;
+	decl = build_decl (declarator->id_loc,
+			   VAR_DECL, declarator->u.id, type);
 	if (size_varies)
 	  C_DECL_VARIABLE_SIZE (decl) = 1;
 
 	if (declspecs->inline_p)
-	  pedwarn (input_location, 0, "variable %q+D declared %<inline%>", decl);
+	  pedwarn (loc, 0, "variable %q+D declared %<inline%>", decl);
 
 	/* At file scope, an initialized extern declaration may follow
 	   a static declaration.  In that case, DECL_EXTERNAL will be
@@ -4939,7 +4952,7 @@ grokdeclarator (const struct c_declarato
 	&& variably_modified_type_p (type, NULL_TREE))
       {
 	/* C99 6.7.5.2p2 */
-	error ("object with variably modified type must have no linkage");
+	error_at (loc, "object with variably modified type must have no linkage");
       }
 
     /* Record `register' declaration for warnings on &
@@ -5263,11 +5276,12 @@ get_parm_info (bool ellipsis)
 }
 
 /* Get the struct, enum or union (CODE says which) with tag NAME.
-   Define the tag as a forward-reference if it is not defined.
-   Return a c_typespec structure for the type specifier.  */
+   Define the tag as a forward-reference with location LOC if it is
+   not defined.  Return a c_typespec structure for the type
+   specifier.  */
 
 struct c_typespec
-parser_xref_tag (enum tree_code code, tree name)
+parser_xref_tag (location_t loc, enum tree_code code, tree name)
 {
   struct c_typespec ret;
   /* If a cross reference is requested, look up the type
@@ -5311,7 +5325,7 @@ parser_xref_tag (enum tree_code code, tr
       TYPE_MAX_VALUE (ref) = TYPE_MAX_VALUE (unsigned_type_node);
     }
 
-  pushtag (name, ref);
+  pushtag (loc, name, ref);
 
   ret.spec = ref;
   return ret;
@@ -5324,15 +5338,16 @@ parser_xref_tag (enum tree_code code, tr
 tree
 xref_tag (enum tree_code code, tree name)
 {
-  return parser_xref_tag (code, name).spec;
+  return parser_xref_tag (input_location, code, name).spec;
 }
 
 /* Make sure that the tag NAME is defined *in the current scope*
    at least as a forward reference.
+   LOC is the location of the struct's definition.
    CODE says which kind of tag NAME ought to be.  */
 
 tree
-start_struct (enum tree_code code, tree name)
+start_struct (location_t loc, enum tree_code code, tree name)
 {
   /* If there is already a tag defined at this scope
      (as a forward reference), just return it.  */
@@ -5346,16 +5361,16 @@ start_struct (enum tree_code code, tree 
       if (TYPE_SIZE (ref))
 	{
 	  if (code == UNION_TYPE)
-	    error ("redefinition of %<union %E%>", name);
+	    error_at (loc, "redefinition of %<union %E%>", name);
 	  else
-	    error ("redefinition of %<struct %E%>", name);
+	    error_at (loc, "redefinition of %<struct %E%>", name);
 	}
       else if (C_TYPE_BEING_DEFINED (ref))
 	{
 	  if (code == UNION_TYPE)
-	    error ("nested redefinition of %<union %E%>", name);
+	    error_at (loc, "nested redefinition of %<union %E%>", name);
 	  else
-	    error ("nested redefinition of %<struct %E%>", name);
+	    error_at (loc, "nested redefinition of %<struct %E%>", name);
 	  /* Don't create structures that contain themselves.  */
 	  ref = NULL_TREE;
 	}
@@ -5366,7 +5381,7 @@ start_struct (enum tree_code code, tree 
   if (ref == NULL_TREE || TREE_CODE (ref) != code)
     {
       ref = make_node (code);
-      pushtag (name, ref);
+      pushtag (loc, name, ref);
     }
 
   C_TYPE_BEING_DEFINED (ref) = 1;
@@ -5507,11 +5522,12 @@ detect_field_duplicates (tree fieldlist)
 }
 
 /* Fill in the fields of a RECORD_TYPE or UNION_TYPE node, T.
+   LOC is the location of the RECORD_TYPE or UNION_TYPE's definition.
    FIELDLIST is a chain of FIELD_DECL nodes for the fields.
    ATTRIBUTES are attributes to be applied to the structure.  */
 
 tree
-finish_struct (tree t, tree fieldlist, tree attributes)
+finish_struct (location_t loc, tree t, tree fieldlist, tree attributes)
 {
   tree x;
   bool toplevel = file_scope == current_scope;
@@ -5535,16 +5551,16 @@ finish_struct (tree t, tree fieldlist, t
 	  if (TREE_CODE (t) == UNION_TYPE)
 	    {
 	      if (fieldlist)
-		pedwarn (input_location, OPT_pedantic, "union has no named members");
+		pedwarn (loc, OPT_pedantic, "union has no named members");
 	      else
-		pedwarn (input_location, OPT_pedantic, "union has no members");
+		pedwarn (loc, OPT_pedantic, "union has no members");
 	    }
 	  else
 	    {
 	      if (fieldlist)
-		pedwarn (input_location, OPT_pedantic, "struct has no named members");
+		pedwarn (loc, OPT_pedantic, "struct has no named members");
 	      else
-		pedwarn (input_location, OPT_pedantic, "struct has no members");
+		pedwarn (loc, OPT_pedantic, "struct has no members");
 	    }
 	}
     }
@@ -5606,24 +5622,28 @@ finish_struct (tree t, tree fieldlist, t
 	{
 	  if (TREE_CODE (t) == UNION_TYPE)
 	    {
-	      error ("%Jflexible array member in union", x);
+	      error_at (DECL_SOURCE_LOCATION (x),
+			"%Jflexible array member in union", x);
 	      TREE_TYPE (x) = error_mark_node;
 	    }
 	  else if (TREE_CHAIN (x) != NULL_TREE)
 	    {
-	      error ("%Jflexible array member not at end of struct", x);
+	      error_at (DECL_SOURCE_LOCATION (x),
+			"%Jflexible array member not at end of struct", x);
 	      TREE_TYPE (x) = error_mark_node;
 	    }
 	  else if (!saw_named_field)
 	    {
-	      error ("%Jflexible array member in otherwise empty struct", x);
+	      error_at (DECL_SOURCE_LOCATION (x),
+			"%Jflexible array member in otherwise empty struct",
+			x);
 	      TREE_TYPE (x) = error_mark_node;
 	    }
 	}
 
       if (pedantic && !in_system_header && TREE_CODE (t) == RECORD_TYPE
 	  && flexible_array_type_p (TREE_TYPE (x)))
-	pedwarn (input_location, OPT_pedantic, 
+	pedwarn (loc, OPT_pedantic, 
 		 "%Jinvalid use of structure with flexible array member", x);
 
       if (DECL_NAME (x))
@@ -5733,7 +5753,7 @@ finish_struct (tree t, tree fieldlist, t
       && (!TYPE_FIELDS (t) || TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t))))
     {
       TYPE_TRANSPARENT_UNION (t) = 0;
-      warning (0, "union cannot be made transparent");
+      warning_at (loc, 0, "union cannot be made transparent");
     }
 
   /* If this structure or union completes the type of any previous
@@ -5764,7 +5784,7 @@ finish_struct (tree t, tree fieldlist, t
      parsing parameters, then arrange for the size of a variable sized type
      to be bound now.  */
   if (cur_stmt_list && variably_modified_type_p (t, NULL_TREE))
-    add_stmt (build_stmt (DECL_EXPR, build_decl (TYPE_DECL, NULL, t)));
+    add_stmt (build_stmt (DECL_EXPR, build_decl (loc, TYPE_DECL, NULL, t)));
 
   return t;
 }
@@ -5781,12 +5801,13 @@ layout_array_type (tree t)
 
 /* Begin compiling the definition of an enumeration type.
    NAME is its name (or null if anonymous).
+   LOC is the enum's location.
    Returns the type object, as yet incomplete.
    Also records info about it so that build_enumerator
    may be used to declare the individual values as they are read.  */
 
 tree
-start_enum (struct c_enum_contents *the_enum, tree name)
+start_enum (location_t loc, struct c_enum_contents *the_enum, tree name)
 {
   tree enumtype = 0;
 
@@ -5800,18 +5821,18 @@ start_enum (struct c_enum_contents *the_
   if (enumtype == 0 || TREE_CODE (enumtype) != ENUMERAL_TYPE)
     {
       enumtype = make_node (ENUMERAL_TYPE);
-      pushtag (name, enumtype);
+      pushtag (loc, name, enumtype);
     }
 
   if (C_TYPE_BEING_DEFINED (enumtype))
-    error ("nested redefinition of %<enum %E%>", name);
+    error_at (loc, "nested redefinition of %<enum %E%>", name);
 
   C_TYPE_BEING_DEFINED (enumtype) = 1;
 
   if (TYPE_VALUES (enumtype) != 0)
     {
       /* This enum is a named one that has been declared already.  */
-      error ("redeclaration of %<enum %E%>", name);
+      error_at (loc, "redeclaration of %<enum %E%>", name);
 
       /* Completely replace its old definition.
 	 The old enumerators remain defined, however.  */
@@ -5968,12 +5989,13 @@ finish_enum (tree enumtype, tree values,
 
 /* Build and install a CONST_DECL for one value of the
    current enumeration type (one that was begun with start_enum).
+   LOC is the location of the enumerator.
    Return a tree-list containing the CONST_DECL and its value.
    Assignment of sequential values by default is handled here.  */
 
 tree
-build_enumerator (struct c_enum_contents *the_enum, tree name, tree value,
-		  location_t value_loc)
+build_enumerator (location_t loc,
+		  struct c_enum_contents *the_enum, tree name, tree value)
 {
   tree decl, type;
 
@@ -5988,7 +6010,8 @@ build_enumerator (struct c_enum_contents
       else if (!INTEGRAL_TYPE_P (TREE_TYPE (value))
 	       || TREE_CODE (value) != INTEGER_CST)
 	{
-	  error ("enumerator value for %qE is not an integer constant", name);
+	  error_at (loc, "enumerator value for %qE is not an integer constant",
+		    name);
 	  value = 0;
 	}
       else
@@ -6005,14 +6028,14 @@ build_enumerator (struct c_enum_contents
     {
       value = the_enum->enum_next_value;
       if (the_enum->enum_overflow)
-	error ("overflow in enumeration values");
+	error_at (loc, "overflow in enumeration values");
     }
   /* Even though the underlying type of an enum is unspecified, the
      type of enumeration constants is explicitly defined as int
      (6.4.4.3/2 in the C99 Standard).  GCC allows any integer type as
      an extension.  */
   else if (!int_fits_type_p (value, integer_type_node))
-    pedwarn (value_loc, OPT_pedantic, 
+    pedwarn (loc, OPT_pedantic, 
 	     "ISO C restricts enumerator values to range of %<int%>");
 
   /* The ISO C Standard mandates enumerators to have type int, even
@@ -6043,7 +6066,7 @@ build_enumerator (struct c_enum_contents
 				  >= TYPE_PRECISION (integer_type_node)
 				  && TYPE_UNSIGNED (type)));
 
-  decl = build_decl (CONST_DECL, name, type);
+  decl = build_decl (loc, CONST_DECL, name, type);
   DECL_INITIAL (decl) = convert (type, value);
   pushdecl (decl);
 
@@ -6071,6 +6094,7 @@ start_function (struct c_declspecs *decl
   tree restype, resdecl;
   struct c_label_context_se *nstack_se;
   struct c_label_context_vm *nstack_vm;
+  location_t loc;
 
   current_function_returns_value = 0;  /* Assume, until we see it does.  */
   current_function_returns_null = 0;
@@ -6108,13 +6132,16 @@ start_function (struct c_declspecs *decl
       return 0;
     }
 
+  loc = DECL_SOURCE_LOCATION (decl1);
+
   decl_attributes (&decl1, attributes, 0);
 
   if (DECL_DECLARED_INLINE_P (decl1)
       && DECL_UNINLINABLE (decl1)
       && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl1)))
-    warning (OPT_Wattributes, "inline function %q+D given attribute noinline",
-	     decl1);
+    warning_at (loc, OPT_Wattributes,
+		"inline function %qD given attribute noinline",
+		decl1);
 
   /* Handle gnu_inline attribute.  */
   if (declspecs->inline_p
@@ -6131,7 +6158,7 @@ start_function (struct c_declspecs *decl
 
   if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl1))))
     {
-      error ("return type is an incomplete type");
+      error_at (loc, "return type is an incomplete type");
       /* Make it return void instead.  */
       TREE_TYPE (decl1)
 	= build_function_type (void_type_node,
@@ -6139,7 +6166,7 @@ start_function (struct c_declspecs *decl
     }
 
   if (warn_about_return_type)
-    pedwarn_c99 (input_location, flag_isoc99 ? 0 
+    pedwarn_c99 (loc, flag_isoc99 ? 0 
 		 : (warn_return_type ? OPT_Wreturn_type : OPT_Wimplicit_int),
 		 "return type defaults to %<int%>");
 
@@ -6206,15 +6233,16 @@ start_function (struct c_declspecs *decl
       && old_decl != error_mark_node
       && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0
       && C_DECL_ISNT_PROTOTYPE (old_decl))
-    warning (OPT_Wstrict_prototypes,
-	     "function declaration isn%'t a prototype");
+    warning_at (loc, OPT_Wstrict_prototypes,
+		"function declaration isn%'t a prototype");
   /* Optionally warn of any global def with no previous prototype.  */
   else if (warn_missing_prototypes
 	   && old_decl != error_mark_node
 	   && TREE_PUBLIC (decl1)
 	   && !MAIN_NAME_P (DECL_NAME (decl1))
 	   && C_DECL_ISNT_PROTOTYPE (old_decl))
-    warning (OPT_Wmissing_prototypes, "no previous prototype for %q+D", decl1);
+    warning_at (loc, OPT_Wmissing_prototypes,
+		"no previous prototype for %qD", decl1);
   /* Optionally warn of any def with no previous prototype
      if the function has already been used.  */
   else if (warn_missing_prototypes
@@ -6222,15 +6250,16 @@ start_function (struct c_declspecs *decl
 	   && old_decl != error_mark_node
 	   && TREE_USED (old_decl)
 	   && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0)
-    warning (OPT_Wmissing_prototypes,
-	     "%q+D was used with no prototype before its definition", decl1);
+    warning_at (loc, OPT_Wmissing_prototypes,
+		"%qD was used with no prototype before its definition", decl1);
   /* Optionally warn of any global def with no previous declaration.  */
   else if (warn_missing_declarations
 	   && TREE_PUBLIC (decl1)
 	   && old_decl == 0
 	   && !MAIN_NAME_P (DECL_NAME (decl1)))
-    warning (OPT_Wmissing_declarations, "no previous declaration for %q+D",
-	     decl1);
+    warning_at (loc, OPT_Wmissing_declarations,
+		"no previous declaration for %qD",
+		decl1);
   /* Optionally warn of any def with no previous declaration
      if the function has already been used.  */
   else if (warn_missing_declarations
@@ -6238,8 +6267,8 @@ start_function (struct c_declspecs *decl
 	   && old_decl != error_mark_node
 	   && TREE_USED (old_decl)
 	   && C_DECL_IMPLICIT (old_decl))
-    warning (OPT_Wmissing_declarations,
-	     "%q+D was used with no declaration before its definition", decl1);
+    warning_at (loc, OPT_Wmissing_declarations,
+		"%qD was used with no declaration before its definition", decl1);
 
   /* This function exists in static storage.
      (This does not mean `static' in the C sense!)  */
@@ -6262,12 +6291,13 @@ start_function (struct c_declspecs *decl
     {
       if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
 	  != integer_type_node)
-	pedwarn (input_location, OPT_Wmain, "return type of %q+D is not %<int%>", decl1);
+	pedwarn (loc, OPT_Wmain, "return type of %qD is not %<int%>", decl1);
 
       check_main_parameter_types (decl1);
 
       if (!TREE_PUBLIC (decl1))
-	pedwarn (input_location, OPT_Wmain, "%q+D is normally a non-static function", decl1);
+	pedwarn (loc, OPT_Wmain,
+		 "%qD is normally a non-static function", decl1);
     }
 
   /* Record the decl so that the function name is defined.
@@ -6280,7 +6310,7 @@ start_function (struct c_declspecs *decl
   declare_parm_level ();
 
   restype = TREE_TYPE (TREE_TYPE (current_function_decl));
-  resdecl = build_decl (RESULT_DECL, NULL_TREE, restype);
+  resdecl = build_decl (loc, RESULT_DECL, NULL_TREE, restype);
   DECL_ARTIFICIAL (resdecl) = 1;
   DECL_IGNORED_P (resdecl) = 1;
   DECL_RESULT (current_function_decl) = resdecl;
@@ -6365,8 +6395,8 @@ store_parm_decls_oldstyle (tree fndecl, 
   struct pointer_set_t *seen_args = pointer_set_create ();
 
   if (!in_system_header)
-    warning (OPT_Wold_style_definition, "%Jold-style function definition",
-	     fndecl);
+    warning_at (DECL_SOURCE_LOCATION (fndecl),
+		OPT_Wold_style_definition, "old-style function definition");
 
   /* Match each formal parameter name with its declaration.  Save each
      decl in the appropriate TREE_PURPOSE slot of the parmids chain.  */
@@ -6374,7 +6404,8 @@ store_parm_decls_oldstyle (tree fndecl, 
     {
       if (TREE_VALUE (parm) == 0)
 	{
-	  error ("%Jparameter name missing from parameter list", fndecl);
+	  error_at (DECL_SOURCE_LOCATION (fndecl),
+		    "parameter name missing from parameter list");
 	  TREE_PURPOSE (parm) = 0;
 	  continue;
 	}
@@ -6385,12 +6416,14 @@ store_parm_decls_oldstyle (tree fndecl, 
 	  decl = b->decl;
 	  /* If we got something other than a PARM_DECL it is an error.  */
 	  if (TREE_CODE (decl) != PARM_DECL)
-	    error ("%q+D declared as a non-parameter", decl);
+	    error_at (DECL_SOURCE_LOCATION (decl),
+		      "%qD declared as a non-parameter", decl);
 	  /* If the declaration is already marked, we have a duplicate
 	     name.  Complain and ignore the duplicate.  */
 	  else if (pointer_set_contains (seen_args, decl))
 	    {
-	      error ("multiple parameters named %q+D", decl);
+	      error_at (DECL_SOURCE_LOCATION (decl),
+			"multiple parameters named %qD", decl);
 	      TREE_PURPOSE (parm) = 0;
 	      continue;
 	    }
@@ -6398,7 +6431,8 @@ store_parm_decls_oldstyle (tree fndecl, 
 	     an int.  */
 	  else if (VOID_TYPE_P (TREE_TYPE (decl)))
 	    {
-	      error ("parameter %q+D declared with void type", decl);
+	      error_at (DECL_SOURCE_LOCATION (decl),
+			"parameter %qD declared with void type", decl);
 	      TREE_TYPE (decl) = integer_type_node;
 	      DECL_ARG_TYPE (decl) = integer_type_node;
 	      layout_decl (decl, 0);
@@ -6408,16 +6442,19 @@ store_parm_decls_oldstyle (tree fndecl, 
       /* If no declaration found, default to int.  */
       else
 	{
-	  decl = build_decl (PARM_DECL, TREE_VALUE (parm), integer_type_node);
+	  decl = build_decl (DECL_SOURCE_LOCATION (fndecl),
+			     PARM_DECL, TREE_VALUE (parm), integer_type_node);
 	  DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
-	  DECL_SOURCE_LOCATION (decl) = DECL_SOURCE_LOCATION (fndecl);
 	  pushdecl (decl);
 	  warn_if_shadowing (decl);
 
 	  if (flag_isoc99)
-	    pedwarn (input_location, 0, "type of %q+D defaults to %<int%>", decl);
+	    pedwarn (DECL_SOURCE_LOCATION (decl),
+		     0, "type of %qD defaults to %<int%>", decl);
 	  else 
-	    warning (OPT_Wmissing_parameter_type, "type of %q+D defaults to %<int%>", decl);
+	    warning_at (DECL_SOURCE_LOCATION (decl),
+			OPT_Wmissing_parameter_type,
+			"type of %qD defaults to %<int%>", decl);
 	}
 
       TREE_PURPOSE (parm) = decl;
@@ -6436,13 +6473,16 @@ store_parm_decls_oldstyle (tree fndecl, 
       if (TREE_TYPE (parm) != error_mark_node
 	  && !COMPLETE_TYPE_P (TREE_TYPE (parm)))
 	{
-	  error ("parameter %q+D has incomplete type", parm);
+	  error_at (DECL_SOURCE_LOCATION (parm),
+		    "parameter %qD has incomplete type", parm);
 	  TREE_TYPE (parm) = error_mark_node;
 	}
 
       if (!pointer_set_contains (seen_args, parm))
 	{
-	  error ("declaration for parameter %q+D but no such parameter", parm);
+	  error_at (DECL_SOURCE_LOCATION (parm),
+		    "declaration for parameter %qD but no such parameter",
+		    parm);
 
 	  /* Pretend the parameter was not missing.
 	     This gets us to a standard state and minimizes
@@ -6492,13 +6532,22 @@ store_parm_decls_oldstyle (tree fndecl, 
 	      || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
 	    {
 	      if (current_function_prototype_built_in)
-		warning (0, "number of arguments doesn%'t match "
-			 "built-in prototype");
+		warning_at (DECL_SOURCE_LOCATION (fndecl),
+			    0, "number of arguments doesn%'t match "
+			    "built-in prototype");
 	      else
 		{
-		  error ("number of arguments doesn%'t match prototype");
-		  error ("%Hprototype declaration",
-			 &current_function_prototype_locus);
+		  /* FIXME diagnostics: This should be the location of
+		     FNDECL, but there is bug when a prototype is
+		     declared inside function context, but defined
+		     outside of it (e.g., gcc.dg/pr15698-2.c).  In
+		     which case FNDECL gets the location of the
+		     prototype, not the definition.  */
+		  error_at (input_location,
+			    "number of arguments doesn%'t match prototype");
+
+		  error_at (current_function_prototype_locus,
+			    "prototype declaration");
 		}
 	      break;
 	    }
@@ -6531,11 +6580,13 @@ store_parm_decls_oldstyle (tree fndecl, 
 		     been diagnosed as conflicting with an
 		     old-style definition and discarded?  */
 		  if (current_function_prototype_built_in)
-		    warning (OPT_pedantic, "promoted argument %qD "
-			     "doesn%'t match built-in prototype", parm);
+		    warning_at (DECL_SOURCE_LOCATION (parm),
+				OPT_pedantic, "promoted argument %qD "
+				"doesn%'t match built-in prototype", parm);
 		  else
 		    {
-		      pedwarn (input_location, OPT_pedantic, "promoted argument %qD "
+		      pedwarn (DECL_SOURCE_LOCATION (parm),
+			       OPT_pedantic, "promoted argument %qD "
 			       "doesn%'t match prototype", parm);
 		      pedwarn (current_function_prototype_locus, OPT_pedantic,
 			       "prototype declaration");
@@ -6544,13 +6595,15 @@ store_parm_decls_oldstyle (tree fndecl, 
 	      else
 		{
 		  if (current_function_prototype_built_in)
-		    warning (0, "argument %qD doesn%'t match "
-			     "built-in prototype", parm);
+		    warning_at (DECL_SOURCE_LOCATION (parm),
+				0, "argument %qD doesn%'t match "
+				"built-in prototype", parm);
 		  else
 		    {
-		      error ("argument %qD doesn%'t match prototype", parm);
-		      error ("%Hprototype declaration",
-			     &current_function_prototype_locus);
+		      error_at (DECL_SOURCE_LOCATION (parm),
+				"argument %qD doesn%'t match prototype", parm);
+		      error_at (current_function_prototype_locus,
+				"prototype declaration");
 		    }
 		}
 	    }
@@ -7006,7 +7059,7 @@ record_builtin_type (enum rid rid_index,
     id = ridpointers[(int) rid_index];
   else
     id = get_identifier (name);
-  decl = build_decl (TYPE_DECL, id, type);
+  decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, id, type);
   pushdecl (decl);
   if (debug_hooks->type_decl)
     debug_hooks->type_decl (decl, false);
Index: tree-eh.c
===================================================================
--- tree-eh.c	(revision 141983)
+++ tree-eh.c	(working copy)
@@ -495,7 +495,7 @@ replace_goto_queue_cond_clause (tree *tp
       return;
     }
 
-  label = create_artificial_label ();
+  label = create_artificial_label (UNKNOWN_LOCATION);
   /* Set the new label for the GIMPLE_COND */
   *tp = label;
 
@@ -835,7 +835,7 @@ frob_into_branch_around (gimple tp, tree
   if (gimple_seq_may_fallthru (result))
     {
       if (!over)
-	over = create_artificial_label ();
+	over = create_artificial_label (UNKNOWN_LOCATION);
       x = gimple_build_goto (over);
       gimple_seq_add_stmt (&result, x);
     }
@@ -886,7 +886,7 @@ lower_try_finally_fallthru_label (struct
 
   if (!label)
     {
-      label = create_artificial_label ();
+      label = create_artificial_label (UNKNOWN_LOCATION);
       tf->fallthru_label = label;
       if (tf->outer->tf)
         {
@@ -1078,7 +1078,7 @@ lower_try_finally_nofallthru (struct leh
   if (tf->may_throw)
     lab = tf->eh_label;
   else
-    lab = create_artificial_label ();
+    lab = create_artificial_label (UNKNOWN_LOCATION);
 
   /* We expect that tf->top_p is a GIMPLE_TRY. */
   finally = gimple_try_cleanup (tf->top_p);
@@ -1144,7 +1144,7 @@ lower_try_finally_onedest (struct leh_st
       return;
     }
 
-  finally_label = create_artificial_label ();
+  finally_label = create_artificial_label (UNKNOWN_LOCATION);
   x = gimple_build_label (finally_label);
   gimple_seq_add_stmt (&tf->top_p_seq, x);
 
@@ -1258,7 +1258,8 @@ lower_try_finally_copy (struct leh_state
 	  if (! q)
 	    continue;
 
-	  lab = labels[index].label = create_artificial_label ();
+	  lab = labels[index].label
+	    = create_artificial_label (UNKNOWN_LOCATION);
 
 	  if (index == return_index)
 	    do_return_redirection (q, lab, NULL, &return_val);
@@ -1341,7 +1342,7 @@ lower_try_finally_switch (struct leh_sta
   ndests = fallthru_index + tf->may_fallthru;
 
   finally_tmp = create_tmp_var (integer_type_node, "finally_tmp");
-  finally_label = create_artificial_label ();
+  finally_label = create_artificial_label (UNKNOWN_LOCATION);
 
   /* We use VEC_quick_push on case_label_vec throughout this function,
      since we know the size in advance and allocate precisely as muce
@@ -1369,7 +1370,7 @@ lower_try_finally_switch (struct leh_sta
 
       last_case = build3 (CASE_LABEL_EXPR, void_type_node,
 			  build_int_cst (NULL_TREE, fallthru_index), NULL,
-			  create_artificial_label ());
+			  create_artificial_label (UNKNOWN_LOCATION));
       VEC_quick_push (tree, case_label_vec, last_case);
       last_case_index++;
 
@@ -1392,7 +1393,7 @@ lower_try_finally_switch (struct leh_sta
 
       last_case = build3 (CASE_LABEL_EXPR, void_type_node,
 			  build_int_cst (NULL_TREE, eh_index), NULL,
-			  create_artificial_label ());
+			  create_artificial_label (UNKNOWN_LOCATION));
       VEC_quick_push (tree, case_label_vec, last_case);
       last_case_index++;
 
@@ -1476,7 +1477,7 @@ lower_try_finally_switch (struct leh_sta
       gcc_assert (slot);
       cont_stmt = *(gimple *) slot;
 
-      label = create_artificial_label ();
+      label = create_artificial_label (UNKNOWN_LOCATION);
       CASE_LABEL (last_case) = label;
 
       x = gimple_build_label (label);
@@ -1584,7 +1585,7 @@ lower_try_finally (struct leh_state *sta
     this_tf.may_throw = get_eh_region_may_contain_throw (this_tf.region);
   if (this_tf.may_throw)
     {
-      this_tf.eh_label = create_artificial_label ();
+      this_tf.eh_label = create_artificial_label (UNKNOWN_LOCATION);
       set_eh_region_tree_label (this_tf.region, this_tf.eh_label);
       honor_protect_cleanup_actions (state, &this_state, &this_tf);
     }
@@ -1675,7 +1676,7 @@ lower_catch (struct leh_state *state, gi
       this_state.prev_try = state->prev_try;
       lower_eh_constructs_1 (&this_state, gimple_catch_handler (gcatch));
 
-      eh_label = create_artificial_label ();
+      eh_label = create_artificial_label (UNKNOWN_LOCATION);
       set_eh_region_tree_label (catch_region, eh_label);
 
       x = gimple_build_label (eh_label);
@@ -1684,7 +1685,7 @@ lower_catch (struct leh_state *state, gi
       if (gimple_seq_may_fallthru (gimple_catch_handler (gcatch)))
 	{
 	  if (!out_label)
-	    out_label = create_artificial_label ();
+	    out_label = create_artificial_label (UNKNOWN_LOCATION);
 
 	  x = gimple_build_goto (out_label);
 	  gimple_seq_add_stmt (gimple_catch_handler_ptr (gcatch), x);
@@ -1734,7 +1735,7 @@ lower_eh_filter (struct leh_state *state
   lower_eh_constructs_1 (state, gimple_eh_filter_failure (inner));
   gimple_try_set_cleanup (tp, gimple_eh_filter_failure (inner));
 
-  eh_label = create_artificial_label ();
+  eh_label = create_artificial_label (UNKNOWN_LOCATION);
   set_eh_region_tree_label (this_region, eh_label);
 
   return frob_into_branch_around (tp, eh_label, NULL);
@@ -1779,7 +1780,7 @@ lower_cleanup (struct leh_state *state, 
   fake_tf.may_fallthru = gimple_seq_may_fallthru (gimple_try_eval (tp));
   fake_tf.may_throw = true;
 
-  fake_tf.eh_label = create_artificial_label ();
+  fake_tf.eh_label = create_artificial_label (UNKNOWN_LOCATION);
   set_eh_region_tree_label (this_region, fake_tf.eh_label);
 
   honor_protect_cleanup_actions (state, NULL, &fake_tf);
Index: fortran/trans-expr.c
===================================================================
--- fortran/trans-expr.c	(revision 141983)
+++ fortran/trans-expr.c	(working copy)
@@ -3976,7 +3976,8 @@ gfc_conv_expr_reference (gfc_se * se, gf
     {
       tree tmp = se->expr;
       STRIP_TYPE_NOPS (tmp);
-      var = build_decl (CONST_DECL, NULL, TREE_TYPE (tmp));
+      var = build_decl (input_location,
+			CONST_DECL, NULL, TREE_TYPE (tmp));
       DECL_INITIAL (var) = tmp;
       TREE_STATIC (var) = 1;
       pushdecl (var);
Index: fortran/trans-common.c
===================================================================
--- fortran/trans-common.c	(revision 141983)
+++ fortran/trans-common.c	(working copy)
@@ -278,8 +278,8 @@ build_field (segment_info *h, tree union
   unsigned HOST_WIDE_INT desired_align, known_align;
 
   name = get_identifier (h->sym->name);
-  field = build_decl (FIELD_DECL, name, h->field);
-  gfc_set_decl_location (field, &h->sym->declared_at);
+  field = build_decl (h->sym->declared_at.lb->location,
+		      FIELD_DECL, name, h->field);
   known_align = (offset & -offset) * BITS_PER_UNIT;
   if (known_align == 0 || known_align > BIGGEST_ALIGNMENT)
     known_align = BIGGEST_ALIGNMENT;
@@ -349,7 +349,8 @@ build_equiv_decl (tree union_type, bool 
     }
 
   snprintf (name, sizeof (name), "equiv.%d", serial++);
-  decl = build_decl (VAR_DECL, get_identifier (name), union_type);
+  decl = build_decl (input_location,
+		     VAR_DECL, get_identifier (name), union_type);
   DECL_ARTIFICIAL (decl) = 1;
   DECL_IGNORED_P (decl) = 1;
 
@@ -412,7 +413,8 @@ build_common_decl (gfc_common_head *com,
   /* If there is no backend_decl for the common block, build it.  */
   if (decl == NULL_TREE)
     {
-      decl = build_decl (VAR_DECL, get_identifier (com->name), union_type);
+      decl = build_decl (input_location,
+			 VAR_DECL, get_identifier (com->name), union_type);
       SET_DECL_ASSEMBLER_NAME (decl, gfc_sym_mangled_common_id (com));
       TREE_PUBLIC (decl) = 1;
       TREE_STATIC (decl) = 1;
@@ -527,8 +529,8 @@ get_init_field (segment_info *head, tree
   tmp = build_range_type (gfc_array_index_type,
 			  gfc_index_zero_node, tmp);
   tmp = build_array_type (type, tmp);
-  field = build_decl (FIELD_DECL, NULL_TREE, tmp);
-  gfc_set_decl_location (field, &gfc_current_locus);
+  field = build_decl (gfc_current_locus.lb->location,
+		      FIELD_DECL, NULL_TREE, tmp);
 
   known_align = BIGGEST_ALIGNMENT;
 
@@ -675,9 +677,9 @@ create_common (gfc_common_head *com, seg
     {
       tree var_decl;
 
-      var_decl = build_decl (VAR_DECL, DECL_NAME (s->field),
+      var_decl = build_decl (s->sym->declared_at.lb->location,
+			     VAR_DECL, DECL_NAME (s->field),
 			     TREE_TYPE (s->field));
-      gfc_set_decl_location (var_decl, &s->sym->declared_at);
       TREE_PUBLIC (var_decl) = TREE_PUBLIC (decl);
       TREE_STATIC (var_decl) = TREE_STATIC (decl);
       TREE_USED (var_decl) = TREE_USED (decl);
Index: fortran/trans.c
===================================================================
--- fortran/trans.c	(revision 141983)
+++ fortran/trans.c	(working copy)
@@ -1278,10 +1278,9 @@ gfc_generate_module_code (gfc_namespace 
 
   gcc_assert (ns->proc_name->backend_decl == NULL);
   ns->proc_name->backend_decl
-    = build_decl (NAMESPACE_DECL, get_identifier (ns->proc_name->name),
+    = build_decl (ns->proc_name->declared_at.lb->location,
+		  NAMESPACE_DECL, get_identifier (ns->proc_name->name),
 		  void_type_node);
-  gfc_set_decl_location (ns->proc_name->backend_decl,
-			 &ns->proc_name->declared_at);
   entry = gfc_find_module (ns->proc_name->name);
   if (entry->namespace_decl)
     /* Buggy sourcecode, using a module before defining it?  */
Index: fortran/trans-types.c
===================================================================
--- fortran/trans-types.c	(revision 141983)
+++ fortran/trans-types.c	(working copy)
@@ -730,7 +730,8 @@ gfc_init_types (void)
 
   /* Create and name the types.  */
 #define PUSH_TYPE(name, node) \
-  pushdecl (build_decl (TYPE_DECL, get_identifier (name), node))
+  pushdecl (build_decl (input_location, \
+			TYPE_DECL, get_identifier (name), node))
 
   for (index = 0; gfc_integer_kinds[index].kind != 0; ++index)
     {
@@ -1165,19 +1166,22 @@ gfc_get_desc_dim_type (void)
   TYPE_PACKED (type) = 1;
 
   /* Consists of the stride, lbound and ubound members.  */
-  decl = build_decl (FIELD_DECL,
+  decl = build_decl (input_location,
+		     FIELD_DECL,
 		     get_identifier ("stride"), gfc_array_index_type);
   DECL_CONTEXT (decl) = type;
   TREE_NO_WARNING (decl) = 1;
   fieldlist = decl;
 
-  decl = build_decl (FIELD_DECL,
+  decl = build_decl (input_location,
+		     FIELD_DECL,
 		     get_identifier ("lbound"), gfc_array_index_type);
   DECL_CONTEXT (decl) = type;
   TREE_NO_WARNING (decl) = 1;
   fieldlist = chainon (fieldlist, decl);
 
-  decl = build_decl (FIELD_DECL,
+  decl = build_decl (input_location,
+		     FIELD_DECL,
 		     get_identifier ("ubound"), gfc_array_index_type);
   DECL_CONTEXT (decl) = type;
   TREE_NO_WARNING (decl) = 1;
@@ -1429,7 +1433,8 @@ gfc_get_nodesc_array_type (tree etype, g
 				    GFC_TYPE_ARRAY_UBOUND (type, n));
 	  gtype = build_array_type (gtype, rtype);
 	}
-      TYPE_NAME (type) = type_decl = build_decl (TYPE_DECL, NULL, gtype);
+      TYPE_NAME (type) = type_decl = build_decl (input_location,
+						 TYPE_DECL, NULL, gtype);
       DECL_ORIGINAL_TYPE (type_decl) = gtype;
     }
 
@@ -1463,20 +1468,23 @@ gfc_get_array_descriptor_base (int dimen
   TYPE_NAME (fat_type) = get_identifier (name);
 
   /* Add the data member as the first element of the descriptor.  */
-  decl = build_decl (FIELD_DECL, get_identifier ("data"), ptr_type_node);
+  decl = build_decl (input_location,
+		     FIELD_DECL, get_identifier ("data"), ptr_type_node);
 
   DECL_CONTEXT (decl) = fat_type;
   fieldlist = decl;
 
   /* Add the base component.  */
-  decl = build_decl (FIELD_DECL, get_identifier ("offset"),
+  decl = build_decl (input_location,
+		     FIELD_DECL, get_identifier ("offset"),
 		     gfc_array_index_type);
   DECL_CONTEXT (decl) = fat_type;
   TREE_NO_WARNING (decl) = 1;
   fieldlist = chainon (fieldlist, decl);
 
   /* Add the dtype component.  */
-  decl = build_decl (FIELD_DECL, get_identifier ("dtype"),
+  decl = build_decl (input_location,
+		     FIELD_DECL, get_identifier ("dtype"),
 		     gfc_array_index_type);
   DECL_CONTEXT (decl) = fat_type;
   TREE_NO_WARNING (decl) = 1;
@@ -1489,7 +1497,8 @@ gfc_get_array_descriptor_base (int dimen
 					gfc_index_zero_node,
 					gfc_rank_cst[dimen - 1]));
 
-  decl = build_decl (FIELD_DECL, get_identifier ("dim"), arraytype);
+  decl = build_decl (input_location,
+		     FIELD_DECL, get_identifier ("dim"), arraytype);
   DECL_CONTEXT (decl) = fat_type;
   TREE_NO_WARNING (decl) = 1;
   fieldlist = chainon (fieldlist, decl);
@@ -1714,7 +1723,8 @@ gfc_finish_type (tree type)
 {
   tree decl;
 
-  decl = build_decl (TYPE_DECL, NULL_TREE, type);
+  decl = build_decl (input_location,
+		     TYPE_DECL, NULL_TREE, type);
   TYPE_STUB_DECL (type) = decl;
   layout_type (type);
   rest_of_type_compilation (type, 1);
@@ -1733,7 +1743,8 @@ gfc_add_field_to_struct (tree *fieldlist
 {
   tree decl;
 
-  decl = build_decl (FIELD_DECL, name, type);
+  decl = build_decl (input_location,
+		     FIELD_DECL, name, type);
 
   DECL_CONTEXT (decl) = context;
   DECL_INITIAL (decl) = 0;
@@ -2020,7 +2031,8 @@ gfc_get_mixed_entry_union (gfc_namespace
 
       if (el == el2)
 	{
-	  decl = build_decl (FIELD_DECL,
+	  decl = build_decl (input_location,
+			     FIELD_DECL,
 			     get_identifier (el->sym->result->name),
 			     gfc_sym_type (el->sym->result));
 	  DECL_CONTEXT (decl) = type;
@@ -2292,12 +2304,14 @@ gfc_get_array_descr_info (const_tree typ
   ptype = build_pointer_type (gfc_array_index_type);
   if (indirect)
     {
-      info->base_decl = build_decl (VAR_DECL, NULL_TREE,
+      info->base_decl = build_decl (input_location,
+				    VAR_DECL, NULL_TREE,
 				    build_pointer_type (ptype));
       base_decl = build1 (INDIRECT_REF, ptype, info->base_decl);
     }
   else
-    info->base_decl = base_decl = build_decl (VAR_DECL, NULL_TREE, ptype);
+    info->base_decl = base_decl = build_decl (input_location,
+					      VAR_DECL, NULL_TREE, ptype);
 
   if (GFC_TYPE_ARRAY_SPAN (type))
     elem_size = GFC_TYPE_ARRAY_SPAN (type);
Index: fortran/trans-decl.c
===================================================================
--- fortran/trans-decl.c	(revision 141983)
+++ fortran/trans-decl.c	(working copy)
@@ -197,7 +197,8 @@ gfc_build_label_decl (tree label_id)
     label_name = NULL;
 
   /* Build the LABEL_DECL node. Labels have no type.  */
-  label_decl = build_decl (LABEL_DECL, label_id, void_type_node);
+  label_decl = build_decl (input_location,
+			   LABEL_DECL, label_id, void_type_node);
   DECL_CONTEXT (label_decl) = current_function_decl;
   DECL_MODE (label_decl) = VOIDmode;
 
@@ -744,7 +745,8 @@ gfc_build_qualified_array (tree decl, gf
 		DECL_IGNORED_P (GFC_TYPE_ARRAY_UBOUND (type, dim)) = 0;
 	    }
 	}
-      TYPE_NAME (type) = type_decl = build_decl (TYPE_DECL, NULL, gtype);
+      TYPE_NAME (type) = type_decl = build_decl (input_location,
+						 TYPE_DECL, NULL, gtype);
       DECL_ORIGINAL_TYPE (type_decl) = gtype;
     }
 }
@@ -836,7 +838,8 @@ gfc_build_dummy_array_decl (gfc_symbol *
     }
 
   ASM_FORMAT_PRIVATE_NAME (name, IDENTIFIER_POINTER (DECL_NAME (dummy)), 0);
-  decl = build_decl (VAR_DECL, get_identifier (name), type);
+  decl = build_decl (input_location,
+		     VAR_DECL, get_identifier (name), type);
 
   DECL_ARTIFICIAL (decl) = 1;
   TREE_PUBLIC (decl) = 0;
@@ -889,7 +892,8 @@ gfc_create_string_length (gfc_symbol * s
       /* Also prefix the mangled name.  */
       strcpy (&name[1], sym->name);
       name[0] = '.';
-      length = build_decl (VAR_DECL, get_identifier (name),
+      length = build_decl (input_location,
+			   VAR_DECL, get_identifier (name),
 			   gfc_charlen_type_node);
       DECL_ARTIFICIAL (length) = 1;
       TREE_USED (length) = 1;
@@ -916,9 +920,11 @@ gfc_add_assign_aux_vars (gfc_symbol * sy
   decl = sym->backend_decl;
   gfc_allocate_lang_decl (decl);
   GFC_DECL_ASSIGN (decl) = 1;
-  length = build_decl (VAR_DECL, create_tmp_var_name (sym->name),
+  length = build_decl (input_location,
+		       VAR_DECL, create_tmp_var_name (sym->name),
 		       gfc_charlen_type_node);
-  addr = build_decl (VAR_DECL, create_tmp_var_name (sym->name),
+  addr = build_decl (input_location,
+		     VAR_DECL, create_tmp_var_name (sym->name),
 		     pvoid_type_node);
   gfc_finish_var_decl (length, sym);
   gfc_finish_var_decl (addr, sym);
@@ -1031,9 +1037,8 @@ gfc_get_symbol_decl (gfc_symbol * sym)
     length = gfc_create_string_length (sym);
 
   /* Create the decl for the variable.  */
-  decl = build_decl (VAR_DECL, gfc_sym_identifier (sym), gfc_sym_type (sym));
-
-  gfc_set_decl_location (decl, &sym->declared_at);
+  decl = build_decl (sym->declared_at.lb->location,
+		     VAR_DECL, gfc_sym_identifier (sym), gfc_sym_type (sym));
 
   /* Symbols from modules should have their assembler names mangled.
      This is done here rather than in gfc_finish_var_decl because it
@@ -1102,7 +1107,8 @@ gfc_get_symbol_decl (gfc_symbol * sym)
     {
       tree span;
       GFC_DECL_SUBREF_ARRAY_P (decl) = 1;
-      span = build_decl (VAR_DECL, create_tmp_var_name ("span"),
+      span = build_decl (input_location,
+			 VAR_DECL, create_tmp_var_name ("span"),
 			 gfc_array_index_type);
       gfc_finish_var_decl (span, sym);
       TREE_STATIC (span) = TREE_STATIC (decl);
@@ -1167,7 +1173,8 @@ get_proc_pointer_decl (gfc_symbol *sym)
   if (decl)
     return decl;
 
-  decl = build_decl (VAR_DECL, get_identifier (sym->name),
+  decl = build_decl (input_location,
+		     VAR_DECL, get_identifier (sym->name),
 		     build_pointer_type (gfc_get_function_type (sym)));
 
   if ((sym->ns->proc_name
@@ -1276,7 +1283,8 @@ gfc_get_extern_function_decl (gfc_symbol
     }
 
   type = gfc_get_function_type (sym);
-  fndecl = build_decl (FUNCTION_DECL, name, type);
+  fndecl = build_decl (input_location,
+		       FUNCTION_DECL, name, type);
 
   SET_DECL_ASSEMBLER_NAME (fndecl, mangled_name);
   /* If the return type is a pointer, avoid alias issues by setting
@@ -1357,7 +1365,8 @@ build_function_decl (gfc_symbol * sym)
 		 == NAMESPACE_DECL);
 
   type = gfc_get_function_type (sym);
-  fndecl = build_decl (FUNCTION_DECL, gfc_sym_identifier (sym), type);
+  fndecl = build_decl (input_location,
+		       FUNCTION_DECL, gfc_sym_identifier (sym), type);
 
   /* Perform name mangling if this is a top level or module procedure.  */
   if (current_function_decl == NULL_TREE)
@@ -1401,7 +1410,8 @@ build_function_decl (gfc_symbol * sym)
 	type = void_type_node;
     }
 
-  result_decl = build_decl (RESULT_DECL, result_decl, type);
+  result_decl = build_decl (input_location,
+			    RESULT_DECL, result_decl, type);
   DECL_ARTIFICIAL (result_decl) = 1;
   DECL_IGNORED_P (result_decl) = 1;
   DECL_CONTEXT (result_decl) = fndecl;
@@ -1480,7 +1490,8 @@ create_function_arglist (gfc_symbol * sy
   if (sym->attr.entry_master)
     {
       type = TREE_VALUE (typelist);
-      parm = build_decl (PARM_DECL, get_identifier ("__entry"), type);
+      parm = build_decl (input_location,
+			 PARM_DECL, get_identifier ("__entry"), type);
       
       DECL_CONTEXT (parm) = fndecl;
       DECL_ARG_TYPE (parm) = type;
@@ -1502,7 +1513,8 @@ create_function_arglist (gfc_symbol * sy
 	  tree len_type = TREE_VALUE (TREE_CHAIN (typelist));
 	  gcc_assert (len_type == gfc_charlen_type_node);
 
-	  length = build_decl (PARM_DECL,
+	  length = build_decl (input_location,
+			       PARM_DECL,
 			       get_identifier (".__result"),
 			       len_type);
 	  if (!sym->ts.cl->length)
@@ -1524,7 +1536,8 @@ create_function_arglist (gfc_symbol * sy
 
 	      if (sym->ts.cl->backend_decl == NULL)
 		{
-		  tree len = build_decl (VAR_DECL,
+		  tree len = build_decl (input_location,
+					 VAR_DECL,
 					 get_identifier ("..__result"),
 					 gfc_charlen_type_node);
 		  DECL_ARTIFICIAL (len) = 1;
@@ -1544,7 +1557,8 @@ create_function_arglist (gfc_symbol * sy
 	    }
 	}
 
-      parm = build_decl (PARM_DECL, get_identifier ("__result"), type);
+      parm = build_decl (input_location,
+			 PARM_DECL, get_identifier ("__result"), type);
 
       DECL_CONTEXT (parm) = fndecl;
       DECL_ARG_TYPE (parm) = TREE_VALUE (typelist);
@@ -1586,7 +1600,8 @@ create_function_arglist (gfc_symbol * sy
 
 	  strcpy (&name[1], f->sym->name);
 	  name[0] = '_';
-	  length = build_decl (PARM_DECL, get_identifier (name), len_type);
+	  length = build_decl (input_location,
+			       PARM_DECL, get_identifier (name), len_type);
 
 	  hidden_arglist = chainon (hidden_arglist, length);
 	  DECL_CONTEXT (length) = fndecl;
@@ -1640,7 +1655,8 @@ create_function_arglist (gfc_symbol * sy
         type = build_pointer_type (type);
 
       /* Build the argument declaration.  */
-      parm = build_decl (PARM_DECL, gfc_sym_identifier (f->sym), type);
+      parm = build_decl (input_location,
+			 PARM_DECL, gfc_sym_identifier (f->sym), type);
 
       /* Fill in arg stuff.  */
       DECL_CONTEXT (parm) = fndecl;
@@ -1830,7 +1846,8 @@ build_entry_thunks (gfc_namespace * ns)
 	  tree union_decl, field;
 	  tree master_type = TREE_TYPE (ns->proc_name->backend_decl);
 
-	  union_decl = build_decl (VAR_DECL, get_identifier ("__result"),
+	  union_decl = build_decl (input_location,
+				   VAR_DECL, get_identifier ("__result"),
 				   TREE_TYPE (master_type));
 	  DECL_ARTIFICIAL (union_decl) = 1;
 	  DECL_EXTERNAL (union_decl) = 0;
@@ -2045,10 +2062,12 @@ gfc_get_fake_result_decl (gfc_symbol * s
 	       IDENTIFIER_POINTER (DECL_NAME (this_function_decl)));
 
       if (!sym->attr.mixed_entry_master && sym->attr.function)
-	decl = build_decl (VAR_DECL, get_identifier (name),
+	decl = build_decl (input_location,
+			   VAR_DECL, get_identifier (name),
 			   gfc_sym_type (sym));
       else
-	decl = build_decl (VAR_DECL, get_identifier (name),
+	decl = build_decl (input_location,
+			   VAR_DECL, get_identifier (name),
 			   TREE_TYPE (TREE_TYPE (this_function_decl)));
       DECL_ARTIFICIAL (decl) = 1;
       DECL_EXTERNAL (decl) = 0;
@@ -2108,7 +2127,8 @@ gfc_build_library_function_decl (tree na
 
   /* Build the function type and decl.  */
   fntype = build_function_type (rettype, arglist);
-  fndecl = build_decl (FUNCTION_DECL, name, fntype);
+  fndecl = build_decl (input_location,
+		       FUNCTION_DECL, name, fntype);
 
   /* Mark this decl as external.  */
   DECL_EXTERNAL (fndecl) = 1;
@@ -3173,7 +3193,8 @@ gfc_trans_use_stmts (gfc_namespace * ns)
       if (entry->namespace_decl == NULL)
 	{
 	  entry->namespace_decl
-	    = build_decl (NAMESPACE_DECL,
+	    = build_decl (input_location,
+			  NAMESPACE_DECL,
 			  get_identifier (use_stmt->module_name),
 			  void_type_node);
 	  DECL_EXTERNAL (entry->namespace_decl) = 1;
@@ -3350,7 +3371,8 @@ gfc_emit_parameter_debug_info (gfc_symbo
     return;
 
   /* Create the decl for the variable or constant.  */
-  decl = build_decl (sym->attr.flavor == FL_PARAMETER ? CONST_DECL : VAR_DECL,
+  decl = build_decl (input_location,
+		     sym->attr.flavor == FL_PARAMETER ? CONST_DECL : VAR_DECL,
 		     gfc_sym_identifier (sym), gfc_sym_type (sym));
   if (sym->attr.flavor == FL_PARAMETER)
     TREE_READONLY (decl) = 1;
@@ -3951,10 +3973,12 @@ gfc_generate_constructors (void)
   type = build_function_type (void_type_node,
 			      gfc_chainon_list (NULL_TREE, void_type_node));
 
-  fndecl = build_decl (FUNCTION_DECL, fnname, type);
+  fndecl = build_decl (input_location,
+		       FUNCTION_DECL, fnname, type);
   TREE_PUBLIC (fndecl) = 1;
 
-  decl = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
+  decl = build_decl (input_location,
+		     RESULT_DECL, NULL_TREE, void_type_node);
   DECL_ARTIFICIAL (decl) = 1;
   DECL_IGNORED_P (decl) = 1;
   DECL_CONTEXT (decl) = fndecl;
@@ -4023,7 +4047,8 @@ gfc_generate_block_data (gfc_namespace *
   else
     id = get_identifier ("__BLOCK_DATA__");
 
-  decl = build_decl (VAR_DECL, id, gfc_array_index_type);
+  decl = build_decl (input_location,
+		     VAR_DECL, id, gfc_array_index_type);
   TREE_PUBLIC (decl) = 1;
   TREE_STATIC (decl) = 1;
   DECL_IGNORED_P (decl) = 1;
Index: fortran/trans-intrinsic.c
===================================================================
--- fortran/trans-intrinsic.c	(revision 141983)
+++ fortran/trans-intrinsic.c	(working copy)
@@ -692,7 +692,8 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrin
     }
   argtypes = gfc_chainon_list (argtypes, void_type_node);
   type = build_function_type (gfc_typenode_for_spec (ts), argtypes);
-  fndecl = build_decl (FUNCTION_DECL, get_identifier (name), type);
+  fndecl = build_decl (input_location,
+		       FUNCTION_DECL, get_identifier (name), type);
 
   /* Mark the decl as external.  */
   DECL_EXTERNAL (fndecl) = 1;
Index: function.c
===================================================================
--- function.c	(revision 141983)
+++ function.c	(working copy)
@@ -2001,7 +2001,8 @@ split_complex_args (tree args)
 	  layout_decl (p, 0);
 
 	  /* Build a second synthetic decl.  */
-	  decl = build_decl (PARM_DECL, NULL_TREE, subtype);
+	  decl = build_decl (EXPR_LOCATION (p),
+			     PARM_DECL, NULL_TREE, subtype);
 	  DECL_ARG_TYPE (decl) = DECL_ARG_TYPE (p);
 	  DECL_ARTIFICIAL (decl) = addressable;
 	  DECL_IGNORED_P (decl) = addressable;
@@ -2036,7 +2037,8 @@ assign_parms_augmented_arg_list (struct 
       tree type = build_pointer_type (TREE_TYPE (fntype));
       tree decl;
 
-      decl = build_decl (PARM_DECL, NULL_TREE, type);
+      decl = build_decl (DECL_SOURCE_LOCATION (fndecl),
+			 PARM_DECL, NULL_TREE, type);
       DECL_ARG_TYPE (decl) = type;
       DECL_ARTIFICIAL (decl) = 1;
       DECL_IGNORED_P (decl) = 1;
Index: langhooks.c
===================================================================
--- langhooks.c	(revision 141983)
+++ langhooks.c	(working copy)
@@ -540,7 +540,7 @@ add_builtin_function_common (const char 
 			     tree (*hook) (tree))
 {
   tree   id = get_identifier (name);
-  tree decl = build_decl (FUNCTION_DECL, id, type);
+  tree decl = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, id, type);
 
   TREE_PUBLIC (decl)         = 1;
   DECL_EXTERNAL (decl)       = 1;
Index: stor-layout.c
===================================================================
--- stor-layout.c	(revision 141983)
+++ stor-layout.c	(working copy)
@@ -1533,7 +1533,8 @@ finish_builtin_struct (tree type, const 
 #if 0 /* not yet, should get fixed properly later */
   TYPE_NAME (type) = make_type_decl (get_identifier (name), type);
 #else
-  TYPE_NAME (type) = build_decl (TYPE_DECL, get_identifier (name), type);
+  TYPE_NAME (type) = build_decl (BUILTINS_LOCATION,
+				 TYPE_DECL, get_identifier (name), type);
 #endif
   TYPE_STUB_DECL (type) = TYPE_NAME (type);
   layout_decl (TYPE_NAME (type), 0);
Index: c-typeck.c
===================================================================
--- c-typeck.c	(revision 141983)
+++ c-typeck.c	(working copy)
@@ -2186,7 +2186,7 @@ build_external_ref (tree id, int fun, lo
     ref = decl;
   else if (fun)
     /* Implicit function declaration.  */
-    ref = implicitly_declare (id);
+    ref = implicitly_declare (loc, id);
   else if (decl == error_mark_node)
     /* Don't complain about something that's already been
        complained about.  */
@@ -2348,12 +2348,13 @@ c_expr_sizeof_type (struct c_type_name *
 }
 
 /* Build a function call to function FUNCTION with parameters PARAMS.
+   The function call is at LOC.
    PARAMS is a list--a chain of TREE_LIST nodes--in which the
    TREE_VALUE of each node is a parameter-expression.
    FUNCTION's data type may be a function type or a pointer-to-function.  */
 
 tree
-build_function_call (tree function, tree params)
+build_function_call (location_t loc, tree function, tree params)
 {
   tree fntype, fundecl = 0;
   tree name = NULL_TREE, result;
@@ -2372,7 +2373,7 @@ build_function_call (tree function, tree
 	 resolve_overloaded_builtin and targetm.resolve_overloaded_builtin
 	 handle all the type checking.  The result is a complete expression
 	 that implements this function call.  */
-      tem = resolve_overloaded_builtin (function, params);
+      tem = resolve_overloaded_builtin (loc, function, params);
       if (tem)
 	return tem;
 
@@ -2394,7 +2395,7 @@ build_function_call (tree function, tree
   if (!(TREE_CODE (fntype) == POINTER_TYPE
 	&& TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE))
     {
-      error ("called object %qE is not a function", function);
+      error_at (loc, "called object %qE is not a function", function);
       return error_mark_node;
     }
 
@@ -2415,16 +2416,16 @@ build_function_call (tree function, tree
       && !comptypes (fntype, TREE_TYPE (tem)))
     {
       tree return_type = TREE_TYPE (fntype);
-      tree trap = build_function_call (built_in_decls[BUILT_IN_TRAP],
+      tree trap = build_function_call (loc, built_in_decls[BUILT_IN_TRAP],
 				       NULL_TREE);
 
       /* This situation leads to run-time undefined behavior.  We can't,
 	 therefore, simply error unless we can prove that all possible
 	 executions of the program must execute the code.  */
-      if (warning (0, "function called through a non-compatible type"))
+      if (warning_at (loc, 0, "function called through a non-compatible type"))
 	/* We can, however, treat "undefined" any way we please.
 	   Call abort to encourage the user to fix the program.  */
-	inform (input_location, "if this code is reached, the program will abort");
+	inform (loc, "if this code is reached, the program will abort");
 
       if (VOID_TYPE_P (return_type))
 	return trap;
@@ -2433,7 +2434,7 @@ build_function_call (tree function, tree
 	  tree rhs;
 
 	  if (AGGREGATE_TYPE_P (return_type))
-	    rhs = build_compound_literal (return_type,
+	    rhs = build_compound_literal (loc, return_type,
 					  build_constructor (return_type, 0));
 	  else
 	    rhs = fold_convert (return_type, integer_zero_node);
@@ -7346,17 +7347,17 @@ c_start_case (tree exp)
   return add_stmt (cs->switch_expr);
 }
 
-/* Process a case label.  */
+/* Process a case label at location LOC.  */
 
 tree
-do_case (tree low_value, tree high_value)
+do_case (location_t loc, tree low_value, tree high_value)
 {
   tree label = NULL_TREE;
 
   if (c_switch_stack && !c_switch_stack->blocked_stmt_expr
       && !c_switch_stack->blocked_vm)
     {
-      label = c_add_case_label (c_switch_stack->cases,
+      label = c_add_case_label (loc, c_switch_stack->cases,
 				SWITCH_COND (c_switch_stack->switch_expr),
 				c_switch_stack->orig_type,
 				low_value, high_value);
@@ -7366,25 +7367,26 @@ do_case (tree low_value, tree high_value
   else if (c_switch_stack && c_switch_stack->blocked_stmt_expr)
     {
       if (low_value)
-	error ("case label in statement expression not containing "
-	       "enclosing switch statement");
+	error_at (loc, "case label in statement expression not containing "
+		  "enclosing switch statement");
       else
-	error ("%<default%> label in statement expression not containing "
-	       "enclosing switch statement");
+	error_at (loc, "%<default%> label in statement expression not containing "
+		  "enclosing switch statement");
     }
   else if (c_switch_stack && c_switch_stack->blocked_vm)
     {
       if (low_value)
-	error ("case label in scope of identifier with variably modified "
-	       "type not containing enclosing switch statement");
+	error_at (loc, "case label in scope of identifier with variably "
+		  "modified type not containing enclosing switch statement");
       else
-	error ("%<default%> label in scope of identifier with variably "
-	       "modified type not containing enclosing switch statement");
+	error_at (loc, "%<default%> label in scope of identifier with "
+		  "variably modified type not containing enclosing switch "
+		  "statement");
     }
   else if (low_value)
-    error ("case label not within a switch statement");
+    error_at (loc, "case label not within a switch statement");
   else
-    error ("%<default%> label not within a switch statement");
+    error_at (loc, "%<default%> label not within a switch statement");
 
   return label;
 }
@@ -7545,7 +7547,7 @@ c_finish_loop (location_t start_locus, t
 }
 
 tree
-c_finish_bc_stmt (tree *label_p, bool is_break)
+c_finish_bc_stmt (location_t loc, tree *label_p, bool is_break)
 {
   bool skip;
   tree label = *label_p;
@@ -7562,7 +7564,7 @@ c_finish_bc_stmt (tree *label_p, bool is
   if (!label)
     {
       if (!skip)
-	*label_p = label = create_artificial_label ();
+	*label_p = label = create_artificial_label (loc);
     }
   else if (TREE_CODE (label) == LABEL_DECL)
     ;
@@ -7570,14 +7572,14 @@ c_finish_bc_stmt (tree *label_p, bool is
     {
     case 0:
       if (is_break)
-	error ("break statement not within loop or switch");
+	error_at (loc, "break statement not within loop or switch");
       else
-	error ("continue statement not within a loop");
+	error_at (loc, "continue statement not within a loop");
       return NULL_TREE;
 
     case 1:
       gcc_assert (is_break);
-      error ("break statement used with OpenMP for loop");
+      error_at (loc, "break statement used with OpenMP for loop");
       return NULL_TREE;
 
     default:
Index: gimplify.c
===================================================================
--- gimplify.c	(revision 141983)
+++ gimplify.c	(working copy)
@@ -518,7 +518,8 @@ create_tmp_var_raw (tree type, const cha
   new_type = build_type_variant (type, 0, 0);
   TYPE_ATTRIBUTES (new_type) = TYPE_ATTRIBUTES (type);
 
-  tmp_var = build_decl (VAR_DECL, prefix ? create_tmp_var_name (prefix) : NULL,
+  tmp_var = build_decl (input_location,
+			VAR_DECL, prefix ? create_tmp_var_name (prefix) : NULL,
 			type);
 
   /* The variable was declared by the compiler.  */
@@ -1490,7 +1491,7 @@ static enum gimplify_status
 gimplify_loop_expr (tree *expr_p, gimple_seq *pre_p)
 {
   tree saved_label = gimplify_ctxp->exit_label;
-  tree start_label = create_artificial_label ();
+  tree start_label = create_artificial_label (UNKNOWN_LOCATION);
 
   gimplify_seq_add_stmt (pre_p, gimple_build_label (start_label));
 
@@ -1637,7 +1638,8 @@ gimplify_switch_expr (tree *expr_p, gimp
 	  /* If the switch has no default label, add one, so that we jump
 	     around the switch body.  */
 	  default_case = build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE,
-	                         NULL_TREE, create_artificial_label ());
+	                         NULL_TREE,
+				 create_artificial_label (UNKNOWN_LOCATION));
 	  new_default = gimple_build_label (CASE_LABEL (default_case));
 	  gimplify_seq_add_stmt (&switch_body_seq, new_default);
 	}
@@ -1690,7 +1692,7 @@ build_and_jump (tree *label_p)
 
   if (*label_p == NULL_TREE)
     {
-      tree label = create_artificial_label ();
+      tree label = create_artificial_label (UNKNOWN_LOCATION);
       *label_p = label;
     }
 
@@ -2996,7 +2998,7 @@ gimplify_cond_expr (tree *expr_p, gimple
       have_then_clause_p = true;
     }
   else
-    label_true = create_artificial_label ();
+    label_true = create_artificial_label (UNKNOWN_LOCATION);
   if (TREE_OPERAND (expr, 2) != NULL
       && TREE_CODE (TREE_OPERAND (expr, 2)) == GOTO_EXPR
       && TREE_CODE (GOTO_DESTINATION (TREE_OPERAND (expr, 2))) == LABEL_DECL
@@ -3014,7 +3016,7 @@ gimplify_cond_expr (tree *expr_p, gimple
       have_else_clause_p = true;
     }
   else
-    label_false = create_artificial_label ();
+    label_false = create_artificial_label (UNKNOWN_LOCATION);
 
   gimple_cond_get_ops_from_tree (COND_EXPR_COND (expr), &pred_code, &arm1,
 				 &arm2);
@@ -3045,7 +3047,7 @@ gimplify_cond_expr (tree *expr_p, gimple
 	      && gimple_seq_may_fallthru (seq))
 	    {
 	      gimple g;
-	      label_cont = create_artificial_label ();
+	      label_cont = create_artificial_label (UNKNOWN_LOCATION);
 
 	      g = gimple_build_goto (label_cont);
 
@@ -3326,9 +3328,9 @@ gimplify_init_ctor_eval_range (tree obje
   tree loop_entry_label, loop_exit_label, fall_thru_label;
   tree var, var_type, cref, tmp;
 
-  loop_entry_label = create_artificial_label ();
-  loop_exit_label = create_artificial_label ();
-  fall_thru_label = create_artificial_label ();
+  loop_entry_label = create_artificial_label (UNKNOWN_LOCATION);
+  loop_exit_label = create_artificial_label (UNKNOWN_LOCATION);
+  fall_thru_label = create_artificial_label (UNKNOWN_LOCATION);
 
   /* Create and initialize the index variable.  */
   var_type = TREE_TYPE (upper);
Index: c-pragma.c
===================================================================
--- c-pragma.c	(revision 141983)
+++ c-pragma.c	(working copy)
@@ -458,7 +458,8 @@ maybe_apply_pending_pragma_weaks (void)
       if (TREE_VALUE (t) == NULL)
 	continue;
 
-      decl = build_decl (FUNCTION_DECL, alias_id, default_function_type);
+      decl = build_decl (UNKNOWN_LOCATION,
+			 FUNCTION_DECL, alias_id, default_function_type);
 
       DECL_ARTIFICIAL (decl) = 1;
       TREE_PUBLIC (decl) = 1;
Index: expmed.c
===================================================================
--- expmed.c	(revision 141983)
+++ expmed.c	(working copy)
@@ -5002,7 +5002,7 @@ make_tree (tree type, rtx x)
       /* else fall through.  */
 
     default:
-      t = build_decl (VAR_DECL, NULL_TREE, type);
+      t = build_decl (RTL_LOCATION (x), VAR_DECL, NULL_TREE, type);
 
       /* If TYPE is a POINTER_TYPE, X might be Pmode with TYPE_MODE being
 	 ptr_mode.  So convert.  */
Index: except.c
===================================================================
--- except.c	(revision 141983)
+++ except.c	(working copy)
@@ -329,11 +329,13 @@ init_eh (void)
 
       sjlj_fc_type_node = lang_hooks.types.make_type (RECORD_TYPE);
 
-      f_prev = build_decl (FIELD_DECL, get_identifier ("__prev"),
+      f_prev = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
+			   FIELD_DECL, get_identifier ("__prev"),
 			   build_pointer_type (sjlj_fc_type_node));
       DECL_FIELD_CONTEXT (f_prev) = sjlj_fc_type_node;
 
-      f_cs = build_decl (FIELD_DECL, get_identifier ("__call_site"),
+      f_cs = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
+			 FIELD_DECL, get_identifier ("__call_site"),
 			 integer_type_node);
       DECL_FIELD_CONTEXT (f_cs) = sjlj_fc_type_node;
 
@@ -341,14 +343,17 @@ init_eh (void)
       tmp = build_array_type (lang_hooks.types.type_for_mode
 				(targetm.unwind_word_mode (), 1),
 			      tmp);
-      f_data = build_decl (FIELD_DECL, get_identifier ("__data"), tmp);
+      f_data = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
+			   FIELD_DECL, get_identifier ("__data"), tmp);
       DECL_FIELD_CONTEXT (f_data) = sjlj_fc_type_node;
 
-      f_per = build_decl (FIELD_DECL, get_identifier ("__personality"),
+      f_per = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
+			  FIELD_DECL, get_identifier ("__personality"),
 			  ptr_type_node);
       DECL_FIELD_CONTEXT (f_per) = sjlj_fc_type_node;
 
-      f_lsda = build_decl (FIELD_DECL, get_identifier ("__lsda"),
+      f_lsda = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
+			   FIELD_DECL, get_identifier ("__lsda"),
 			   ptr_type_node);
       DECL_FIELD_CONTEXT (f_lsda) = sjlj_fc_type_node;
 
@@ -368,7 +373,8 @@ init_eh (void)
 #endif
       tmp = build_index_type (tmp);
       tmp = build_array_type (ptr_type_node, tmp);
-      f_jbuf = build_decl (FIELD_DECL, get_identifier ("__jbuf"), tmp);
+      f_jbuf = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
+			   FIELD_DECL, get_identifier ("__jbuf"), tmp);
 #ifdef DONT_USE_BUILTIN_SETJMP
       /* We don't know what the alignment requirements of the
 	 runtime's jmp_buf has.  Overestimate.  */
Index: coverage.c
===================================================================
--- coverage.c	(revision 141983)
+++ coverage.c	(working copy)
@@ -419,7 +419,8 @@ coverage_counter_alloc (unsigned counter
       tree gcov_type_array_type
         = build_array_type (gcov_type_node, NULL_TREE);
       tree_ctr_tables[counter]
-        = build_decl (VAR_DECL, NULL_TREE, gcov_type_array_type);
+        = build_decl (input_location,
+		      VAR_DECL, NULL_TREE, gcov_type_array_type);
       TREE_STATIC (tree_ctr_tables[counter]) = 1;
       ASM_GENERATE_INTERNAL_LABEL (buf, "LPBX", counter + 1);
       DECL_NAME (tree_ctr_tables[counter]) = get_identifier (buf);
@@ -638,10 +639,12 @@ build_fn_info_type (unsigned int counter
   tree array_type;
 
   /* ident */
-  fields = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+  fields = build_decl (input_location,
+		       FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
 
   /* checksum */
-  field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
   TREE_CHAIN (field) = fields;
   fields = field;
 
@@ -650,7 +653,8 @@ build_fn_info_type (unsigned int counter
   array_type = build_array_type (get_gcov_unsigned_t (), array_type);
 
   /* counters */
-  field = build_decl (FIELD_DECL, NULL_TREE, array_type);
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, array_type);
   TREE_CHAIN (field) = fields;
   fields = field;
 
@@ -713,12 +717,14 @@ build_ctr_info_type (void)
   tree gcov_merge_fn_type;
 
   /* counters */
-  field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
   TREE_CHAIN (field) = fields;
   fields = field;
 
   /* values */
-  field = build_decl (FIELD_DECL, NULL_TREE, gcov_ptr_type);
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, gcov_ptr_type);
   TREE_CHAIN (field) = fields;
   fields = field;
 
@@ -727,7 +733,8 @@ build_ctr_info_type (void)
     build_function_type_list (void_type_node,
 			      gcov_ptr_type, get_gcov_unsigned_t (),
 			      NULL_TREE);
-  field = build_decl (FIELD_DECL, NULL_TREE,
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE,
 		      build_pointer_type (gcov_merge_fn_type));
   TREE_CHAIN (field) = fields;
   fields = field;
@@ -779,7 +786,8 @@ build_ctr_info_value (unsigned int count
     value = tree_cons (fields, null_pointer_node, value);
   fields = TREE_CHAIN (fields);
 
-  fn = build_decl (FUNCTION_DECL,
+  fn = build_decl (input_location,
+		   FUNCTION_DECL,
 		   get_identifier (ctr_merge_functions[counter]),
 		   TREE_TYPE (TREE_TYPE (fields)));
   DECL_EXTERNAL (fn) = 1;
@@ -824,20 +832,23 @@ build_gcov_info (void)
   const_type = build_qualified_type (type, TYPE_QUAL_CONST);
 
   /* Version ident */
-  field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
   TREE_CHAIN (field) = fields;
   fields = field;
   value = tree_cons (field, build_int_cstu (TREE_TYPE (field), GCOV_VERSION),
 		     value);
 
   /* next -- NULL */
-  field = build_decl (FIELD_DECL, NULL_TREE, build_pointer_type (const_type));
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, build_pointer_type (const_type));
   TREE_CHAIN (field) = fields;
   fields = field;
   value = tree_cons (field, null_pointer_node, value);
 
   /* stamp */
-  field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
   TREE_CHAIN (field) = fields;
   fields = field;
   value = tree_cons (field, build_int_cstu (TREE_TYPE (field), local_tick),
@@ -846,7 +857,8 @@ build_gcov_info (void)
   /* Filename */
   string_type = build_pointer_type (build_qualified_type (char_type_node,
 						    TYPE_QUAL_CONST));
-  field = build_decl (FIELD_DECL, NULL_TREE, string_type);
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, string_type);
   TREE_CHAIN (field) = fields;
   fields = field;
   da_file_name_len = strlen (da_file_name);
@@ -881,7 +893,8 @@ build_gcov_info (void)
     fn_info_value = null_pointer_node;
 
   /* number of functions */
-  field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
   TREE_CHAIN (field) = fields;
   fields = field;
   value = tree_cons (field,
@@ -889,13 +902,15 @@ build_gcov_info (void)
 		     value);
 
   /* fn_info table */
-  field = build_decl (FIELD_DECL, NULL_TREE, fn_info_ptr_type);
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, fn_info_ptr_type);
   TREE_CHAIN (field) = fields;
   fields = field;
   value = tree_cons (field, fn_info_value, value);
 
   /* counter_mask */
-  field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
   TREE_CHAIN (field) = fields;
   fields = field;
   value = tree_cons (field,
@@ -916,7 +931,8 @@ build_gcov_info (void)
   ctr_info_value = build_constructor_from_list (ctr_info_ary_type,
 				                nreverse (ctr_info_value));
 
-  field = build_decl (FIELD_DECL, NULL_TREE, ctr_info_ary_type);
+  field = build_decl (input_location,
+		      FIELD_DECL, NULL_TREE, ctr_info_ary_type);
   TREE_CHAIN (field) = fields;
   fields = field;
   value = tree_cons (field, ctr_info_value, value);
@@ -946,7 +962,8 @@ create_coverage (void)
 
   t = build_gcov_info ();
 
-  gcov_info = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (t));
+  gcov_info = build_decl (input_location,
+			  VAR_DECL, NULL_TREE, TREE_TYPE (t));
   TREE_STATIC (gcov_info) = 1;
   ASM_GENERATE_INTERNAL_LABEL (name_buf, "LPBX", 0);
   DECL_NAME (gcov_info) = get_identifier (name_buf);
@@ -958,7 +975,8 @@ create_coverage (void)
   /* Build a decl for __gcov_init.  */
   t = build_pointer_type (TREE_TYPE (gcov_info));
   t = build_function_type_list (void_type_node, t, NULL);
-  t = build_decl (FUNCTION_DECL, get_identifier ("__gcov_init"), t);
+  t = build_decl (input_location,
+		  FUNCTION_DECL, get_identifier ("__gcov_init"), t);
   TREE_PUBLIC (t) = 1;
   DECL_EXTERNAL (t) = 1;
   gcov_init = t;
Index: emit-rtl.c
===================================================================
--- emit-rtl.c	(revision 141983)
+++ emit-rtl.c	(working copy)
@@ -2150,7 +2150,8 @@ get_spill_slot_decl (bool force_build_p)
   if (d || !force_build_p)
     return d;
 
-  d = build_decl (VAR_DECL, get_identifier ("%sfp"), void_type_node);
+  d = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
+		  VAR_DECL, get_identifier ("%sfp"), void_type_node);
   DECL_ARTIFICIAL (d) = 1;
   DECL_IGNORED_P (d) = 1;
   TREE_USED (d) = 1;
Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 141983)
+++ cfgexpand.c	(working copy)
@@ -1312,7 +1312,8 @@ add_stack_protection_conflicts (void)
 static void
 create_stack_guard (void)
 {
-  tree guard = build_decl (VAR_DECL, NULL, ptr_type_node);
+  tree guard = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
+			   VAR_DECL, NULL, ptr_type_node);
   TREE_THIS_VOLATILE (guard) = 1;
   TREE_USED (guard) = 1;
   expand_one_stack_var (guard);
Index: tree-mudflap.c
===================================================================
--- tree-mudflap.c	(revision 141983)
+++ tree-mudflap.c	(working copy)
@@ -295,7 +295,8 @@ static GTY (()) tree mf_set_options_fnde
 static inline tree
 mf_make_builtin (enum tree_code category, const char *name, tree type)
 {
-  tree decl = mf_mark (build_decl (category, get_identifier (name), type));
+  tree decl = mf_mark (build_decl (UNKNOWN_LOCATION,
+				   category, get_identifier (name), type));
   TREE_PUBLIC (decl) = 1;
   DECL_EXTERNAL (decl) = 1;
   lang_hooks.decls.pushdecl (decl);
@@ -315,8 +316,10 @@ mf_make_mf_cache_struct_type (tree field
   /* There is, abominably, no language-independent way to construct a
      RECORD_TYPE.  So we have to call the basic type construction
      primitives by hand.  */
-  tree fieldlo = build_decl (FIELD_DECL, get_identifier ("low"), field_type);
-  tree fieldhi = build_decl (FIELD_DECL, get_identifier ("high"), field_type);
+  tree fieldlo = build_decl (UNKNOWN_LOCATION,
+			     FIELD_DECL, get_identifier ("low"), field_type);
+  tree fieldhi = build_decl (UNKNOWN_LOCATION,
+			     FIELD_DECL, get_identifier ("high"), field_type);
 
   tree struct_type = make_node (RECORD_TYPE);
   DECL_CONTEXT (fieldlo) = struct_type;
Index: varasm.c
===================================================================
--- varasm.c	(revision 141983)
+++ varasm.c	(working copy)
@@ -241,24 +241,28 @@ default_emutls_var_fields (tree type, tr
 {
   tree word_type_node, field, next_field;
   
-  field = build_decl (FIELD_DECL, get_identifier ("__templ"), ptr_type_node);
+  field = build_decl (UNKNOWN_LOCATION,
+		      FIELD_DECL, get_identifier ("__templ"), ptr_type_node);
   DECL_CONTEXT (field) = type;
   next_field = field;
     
-  field = build_decl (FIELD_DECL, get_identifier ("__offset"),
+  field = build_decl (UNKNOWN_LOCATION,
+		      FIELD_DECL, get_identifier ("__offset"),
 		      ptr_type_node);
   DECL_CONTEXT (field) = type;
   TREE_CHAIN (field) = next_field;
   next_field = field;
   
   word_type_node = lang_hooks.types.type_for_mode (word_mode, 1);
-  field = build_decl (FIELD_DECL, get_identifier ("__align"),
+  field = build_decl (UNKNOWN_LOCATION,
+		      FIELD_DECL, get_identifier ("__align"),
 		      word_type_node);
   DECL_CONTEXT (field) = type;
   TREE_CHAIN (field) = next_field;
   next_field = field;
   
-  field = build_decl (FIELD_DECL, get_identifier ("__size"), word_type_node);
+  field = build_decl (UNKNOWN_LOCATION,
+		      FIELD_DECL, get_identifier ("__size"), word_type_node);
   DECL_CONTEXT (field) = type;
   TREE_CHAIN (field) = next_field;
 
@@ -282,7 +286,8 @@ get_emutls_object_type (void)
   field = targetm.emutls.var_fields (type, &type_name);
   if (!type_name)
     type_name = get_identifier ("__emutls_object");
-  type_name = build_decl (TYPE_DECL, type_name, type);
+  type_name = build_decl (UNKNOWN_LOCATION,
+			  TYPE_DECL, type_name, type);
   TYPE_NAME (type) = type_name;
   TYPE_FIELDS (type) = field;
   layout_type (type);
@@ -311,7 +316,8 @@ get_emutls_init_templ_addr (tree decl)
       name = prefix_name (prefix, name);
     }
 
-  to = build_decl (VAR_DECL, name, TREE_TYPE (decl));
+  to = build_decl (DECL_SOURCE_LOCATION (decl),
+		   VAR_DECL, name, TREE_TYPE (decl));
   SET_DECL_ASSEMBLER_NAME (to, DECL_NAME (to));
   DECL_TLS_MODEL (to) = TLS_MODEL_EMULATED;
   DECL_ARTIFICIAL (to) = 1;
@@ -371,7 +377,8 @@ emutls_decl (tree decl)
     to = h->to;
   else
     {
-      to = build_decl (VAR_DECL, get_emutls_object_name (name),
+      to = build_decl (DECL_SOURCE_LOCATION (decl),
+		       VAR_DECL, get_emutls_object_name (name),
 		       get_emutls_object_type ());
 
       h = GGC_NEW (struct tree_map);
@@ -5072,7 +5079,8 @@ weak_finish (void)
 
 	  if (! decl)
 	    {
-	      decl = build_decl (TREE_CODE (alias_decl), target,
+	      decl = build_decl (DECL_SOURCE_LOCATION (alias_decl),
+				 TREE_CODE (alias_decl), target,
 				 TREE_TYPE (alias_decl));
 
 	      DECL_EXTERNAL (decl) = 1;
Index: tree-nested.c
===================================================================
--- tree-nested.c	(revision 141983)
+++ tree-nested.c	(working copy)
@@ -314,7 +314,8 @@ get_chain_decl (struct nesting_info *inf
 	 Note also that it's represented as a parameter.  This is more
 	 close to the truth, since the initial value does come from 
 	 the caller.  */
-      decl = build_decl (PARM_DECL, create_tmp_var_name ("CHAIN"), type);
+      decl = build_decl (DECL_SOURCE_LOCATION (info->context),
+			 PARM_DECL, create_tmp_var_name ("CHAIN"), type);
       DECL_ARTIFICIAL (decl) = 1;
       DECL_IGNORED_P (decl) = 1;
       TREE_USED (decl) = 1;
@@ -427,7 +428,7 @@ save_tmp_var (struct nesting_info *info,
 static GTY(()) tree trampoline_type;
 
 static tree
-get_trampoline_type (void)
+get_trampoline_type (struct nesting_info *info)
 {
   unsigned align, size;
   tree t;
@@ -448,7 +449,8 @@ get_trampoline_type (void)
 
   t = build_index_type (build_int_cst (NULL_TREE, size - 1));
   t = build_array_type (char_type_node, t);
-  t = build_decl (FIELD_DECL, get_identifier ("__data"), t);
+  t = build_decl (DECL_SOURCE_LOCATION (info->context),
+		  FIELD_DECL, get_identifier ("__data"), t);
   DECL_ALIGN (t) = align;
   DECL_USER_ALIGN (t) = 1;
 
@@ -481,7 +483,7 @@ lookup_tramp_for_decl (struct nesting_in
     {
       tree field = make_node (FIELD_DECL);
       DECL_NAME (field) = DECL_NAME (decl);
-      TREE_TYPE (field) = get_trampoline_type ();
+      TREE_TYPE (field) = get_trampoline_type (info);
       TREE_ADDRESSABLE (field) = 1;
 
       insert_field_into_struct (get_frame_type (info), field);
@@ -817,9 +819,9 @@ get_nonlocal_debug_decl (struct nesting_
     x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
 
   /* ??? We should be remapping types as well, surely.  */
-  new_decl = build_decl (VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+  new_decl = build_decl (DECL_SOURCE_LOCATION (decl),
+			 VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
   DECL_CONTEXT (new_decl) = info->context;
-  DECL_SOURCE_LOCATION (new_decl) = DECL_SOURCE_LOCATION (decl);
   DECL_ARTIFICIAL (new_decl) = DECL_ARTIFICIAL (decl);
   DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
   TREE_THIS_VOLATILE (new_decl) = TREE_THIS_VOLATILE (decl);
@@ -1230,9 +1232,9 @@ get_local_debug_decl (struct nesting_inf
   x = info->frame_decl;
   x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
 
-  new_decl = build_decl (VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+  new_decl = build_decl (DECL_SOURCE_LOCATION (decl),
+			 VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
   DECL_CONTEXT (new_decl) = info->context;
-  DECL_SOURCE_LOCATION (new_decl) = DECL_SOURCE_LOCATION (decl);
   DECL_ARTIFICIAL (new_decl) = DECL_ARTIFICIAL (decl);
   DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
   TREE_THIS_VOLATILE (new_decl) = TREE_THIS_VOLATILE (decl);
@@ -1651,7 +1653,7 @@ convert_nl_goto_reference (gimple_stmt_i
   slot = pointer_map_insert (i->var_map, label);
   if (*slot == NULL)
     {
-      new_label = create_artificial_label ();
+      new_label = create_artificial_label (UNKNOWN_LOCATION);
       DECL_NONLOCAL (new_label) = 1;
       *slot = new_label;
     }
Index: rtl.h
===================================================================
--- rtl.h	(revision 141983)
+++ rtl.h	(working copy)
@@ -753,6 +753,12 @@ extern void rtl_check_failed_flag (const
 
 #define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 3)
 #define INSN_LOCATOR(INSN) XINT (INSN, 4)
+/* LOCATION of an RTX if relevant.  */
+#define RTL_LOCATION(X) (INSN_P (X) ? \
+			 locator_location (INSN_LOCATOR (x)) \
+			 : UNKNOWN_LOCATION)
+/* LOCATION of current INSN.  */
+#define CURR_INSN_LOCATION (locator_location (curr_insn_locator ()))
 /* The body of an insn.  */
 #define PATTERN(INSN)	XEXP (INSN, 5)
 
Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 141983)
+++ tree-inline.c	(working copy)
@@ -4047,7 +4047,8 @@ copy_decl_to_var (tree decl, copy_body_d
 
   type = TREE_TYPE (decl);
 
-  copy = build_decl (VAR_DECL, DECL_NAME (decl), type);
+  copy = build_decl (DECL_SOURCE_LOCATION (id->dst_fn),
+		     VAR_DECL, DECL_NAME (decl), type);
   TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (decl);
   TREE_READONLY (copy) = TREE_READONLY (decl);
   TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (decl);
@@ -4072,7 +4073,8 @@ copy_result_decl_to_var (tree decl, copy
   if (DECL_BY_REFERENCE (decl))
     type = TREE_TYPE (type);
 
-  copy = build_decl (VAR_DECL, DECL_NAME (decl), type);
+  copy = build_decl (DECL_SOURCE_LOCATION (id->dst_fn),
+		     VAR_DECL, DECL_NAME (decl), type);
   TREE_READONLY (copy) = TREE_READONLY (decl);
   TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (decl);
   if (!DECL_BY_REFERENCE (decl))
Index: tree-profile.c
===================================================================
--- tree-profile.c	(revision 141983)
+++ tree-profile.c	(working copy)
@@ -75,7 +75,7 @@ tree_init_ic_make_global_vars (void)
   ptr_void = build_pointer_type (void_type_node);
   
   ic_void_ptr_var 
-    = build_decl (VAR_DECL, 
+    = build_decl (UNKNOWN_LOCATION, VAR_DECL, 
 		  get_identifier ("__gcov_indirect_call_callee"), 
 		  ptr_void);
   TREE_STATIC (ic_void_ptr_var) = 1;
@@ -86,7 +86,7 @@ tree_init_ic_make_global_vars (void)
 
   gcov_type_ptr = build_pointer_type (get_gcov_type ());
   ic_gcov_type_ptr_var 
-    = build_decl (VAR_DECL, 
+    = build_decl (UNKNOWN_LOCATION, VAR_DECL, 
 		  get_identifier ("__gcov_indirect_call_counters"), 
 		  gcov_type_ptr);
   TREE_STATIC (ic_gcov_type_ptr_var) = 1;
Index: c-common.c
===================================================================
--- c-common.c	(revision 141983)
+++ c-common.c	(working copy)
@@ -489,7 +489,7 @@ int max_tinst_depth = 500;
    type names and storage classes.  It is indexed by a RID_... value.  */
 tree *ridpointers;
 
-tree (*make_fname_decl) (tree, int);
+tree (*make_fname_decl) (location_t, tree, int);
 
 /* Nonzero means the expression being parsed will never be evaluated.
    This is a count, since unevaluated expressions can nest.  */
@@ -1014,7 +1014,7 @@ fname_decl (location_t loc, unsigned int
       input_location = UNKNOWN_LOCATION;
 
       stmts = push_stmt_list ();
-      decl = (*make_fname_decl) (id, fname_vars[ix].pretty);
+      decl = (*make_fname_decl) (loc, id, fname_vars[ix].pretty);
       stmts = pop_stmt_list (stmts);
       if (!IS_EMPTY_STMT (stmts))
 	saved_function_name_decls
@@ -2784,7 +2784,8 @@ c_register_builtin_type (tree type, cons
 {
   tree decl;
 
-  decl = build_decl (TYPE_DECL, get_identifier (name), type);
+  decl = build_decl (UNKNOWN_LOCATION,
+		     TYPE_DECL, get_identifier (name), type);
   DECL_ARTIFICIAL (decl) = 1;
   if (!TYPE_NAME (type))
     TYPE_NAME (type) = decl;
@@ -4089,31 +4090,41 @@ c_common_nodes_and_builtins (void)
 
   /* These are types that c_common_type_for_size and
      c_common_type_for_mode use.  */
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 intQI_type_node));
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 intHI_type_node));
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 intSI_type_node));
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 intDI_type_node));
 #if HOST_BITS_PER_WIDE_INT >= 64
   if (targetm.scalar_mode_supported_p (TImode))
-    lang_hooks.decls.pushdecl (build_decl (TYPE_DECL,
+    lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					   TYPE_DECL,
 					   get_identifier ("__int128_t"),
 					   intTI_type_node));
 #endif
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 unsigned_intQI_type_node));
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 unsigned_intHI_type_node));
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 unsigned_intSI_type_node));
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 unsigned_intDI_type_node));
 #if HOST_BITS_PER_WIDE_INT >= 64
   if (targetm.scalar_mode_supported_p (TImode))
-    lang_hooks.decls.pushdecl (build_decl (TYPE_DECL,
+    lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					   TYPE_DECL,
 					   get_identifier ("__uint128_t"),
 					   unsigned_intTI_type_node));
 #endif
@@ -4121,12 +4132,14 @@ c_common_nodes_and_builtins (void)
   /* Create the widest literal types.  */
   widest_integer_literal_type_node
     = make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 widest_integer_literal_type_node));
 
   widest_unsigned_literal_type_node
     = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL, NULL_TREE,
 					 widest_unsigned_literal_type_node));
 
   /* `unsigned long' is the standard type for sizeof.
@@ -4218,17 +4231,21 @@ c_common_nodes_and_builtins (void)
 
     }
 
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL,
 					 get_identifier ("complex int"),
 					 complex_integer_type_node));
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL,
 					 get_identifier ("complex float"),
 					 complex_float_type_node));
-  lang_hooks.decls.pushdecl (build_decl (TYPE_DECL,
+  lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
+					 TYPE_DECL,
 					 get_identifier ("complex double"),
 					 complex_double_type_node));
   lang_hooks.decls.pushdecl
-    (build_decl (TYPE_DECL, get_identifier ("complex long double"),
+    (build_decl (UNKNOWN_LOCATION,
+		 TYPE_DECL, get_identifier ("complex long double"),
 		 complex_long_double_type_node));
 
   if (c_dialect_cxx ())
@@ -4344,7 +4361,8 @@ c_common_nodes_and_builtins (void)
   unsigned_ptrdiff_type_node = c_common_unsigned_type (ptrdiff_type_node);
 
   lang_hooks.decls.pushdecl
-    (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
+    (build_decl (UNKNOWN_LOCATION,
+		 TYPE_DECL, get_identifier ("__builtin_va_list"),
 		 va_list_type_node));
 #ifdef TARGET_ENUM_VA_LIST
   {
@@ -4354,7 +4372,8 @@ c_common_nodes_and_builtins (void)
     for (l = 0; TARGET_ENUM_VA_LIST (l, &pname, &ptype); ++l)
       {
 	lang_hooks.decls.pushdecl
-	  (build_decl (TYPE_DECL, get_identifier (pname),
+	  (build_decl (UNKNOWN_LOCATION,
+		       TYPE_DECL, get_identifier (pname),
 	  	       ptype));
 
       }
@@ -4606,17 +4625,18 @@ case_compare (splay_tree_key k1, splay_t
   return tree_int_cst_compare ((tree) k1, (tree) k2);
 }
 
-/* Process a case label for the range LOW_VALUE ... HIGH_VALUE.  If
-   LOW_VALUE and HIGH_VALUE are both NULL_TREE then this case label is
-   actually a `default' label.  If only HIGH_VALUE is NULL_TREE, then
-   case label was declared using the usual C/C++ syntax, rather than
-   the GNU case range extension.  CASES is a tree containing all the
-   case ranges processed so far; COND is the condition for the
-   switch-statement itself.  Returns the CASE_LABEL_EXPR created, or
-   ERROR_MARK_NODE if no CASE_LABEL_EXPR is created.  */
+/* Process a case label, located at LOC, for the range LOW_VALUE
+   ... HIGH_VALUE.  If LOW_VALUE and HIGH_VALUE are both NULL_TREE
+   then this case label is actually a `default' label.  If only
+   HIGH_VALUE is NULL_TREE, then case label was declared using the
+   usual C/C++ syntax, rather than the GNU case range extension.
+   CASES is a tree containing all the case ranges processed so far;
+   COND is the condition for the switch-statement itself.  Returns the
+   CASE_LABEL_EXPR created, or ERROR_MARK_NODE if no CASE_LABEL_EXPR
+   is created.  */
 
 tree
-c_add_case_label (splay_tree cases, tree cond, tree orig_type,
+c_add_case_label (location_t loc, splay_tree cases, tree cond, tree orig_type,
 		  tree low_value, tree high_value)
 {
   tree type;
@@ -4625,7 +4645,7 @@ c_add_case_label (splay_tree cases, tree
   splay_tree_node node;
 
   /* Create the LABEL_DECL itself.  */
-  label = create_artificial_label ();
+  label = create_artificial_label (loc);
 
   /* If there was an error processing the switch condition, bail now
      before we get more confused.  */
@@ -4637,13 +4657,13 @@ c_add_case_label (splay_tree cases, tree
       || (high_value && TREE_TYPE (high_value)
 	  && POINTER_TYPE_P (TREE_TYPE (high_value))))
     {
-      error ("pointers are not permitted as case values");
+      error_at (loc, "pointers are not permitted as case values");
       goto error_out;
     }
 
   /* Case ranges are a GNU extension.  */
   if (high_value)
-    pedwarn (input_location, OPT_pedantic, 
+    pedwarn (loc, OPT_pedantic, 
 	     "range expressions in switch statements are non-standard");
 
   type = TREE_TYPE (cond);
@@ -4670,7 +4690,7 @@ c_add_case_label (splay_tree cases, tree
       if (tree_int_cst_equal (low_value, high_value))
 	high_value = NULL_TREE;
       else if (!tree_int_cst_lt (low_value, high_value))
-	warning (0, "empty range specified");
+	warning_at (loc, 0, "empty range specified");
     }
 
   /* See if the case is in range of the type of the original testing
@@ -4730,18 +4750,20 @@ c_add_case_label (splay_tree cases, tree
 
       if (high_value)
 	{
-	  error ("duplicate (or overlapping) case value");
-	  error ("%Jthis is the first entry overlapping that value", duplicate);
+	  error_at (loc, "duplicate (or overlapping) case value");
+	  error_at (DECL_SOURCE_LOCATION (duplicate),
+		    "this is the first entry overlapping that value");
 	}
       else if (low_value)
 	{
-	  error ("duplicate case value") ;
-	  error ("%Jpreviously used here", duplicate);
+	  error_at (loc, "duplicate case value") ;
+	  error_at (DECL_SOURCE_LOCATION (duplicate), "previously used here");
 	}
       else
 	{
-	  error ("multiple default labels in one switch");
-	  error ("%Jthis is the first default label", duplicate);
+	  error_at (loc, "multiple default labels in one switch");
+	  error_at (DECL_SOURCE_LOCATION (duplicate),
+		    "this is the first default label");
 	}
       goto error_out;
     }
@@ -4761,7 +4783,7 @@ c_add_case_label (splay_tree cases, tree
      that just leads to duplicates and thence to failure later on.  */
   if (!cases->root)
     {
-      tree t = create_artificial_label ();
+      tree t = create_artificial_label (loc);
       add_stmt (build_stmt (LABEL_EXPR, t));
     }
   return error_mark_node;
@@ -7926,13 +7948,15 @@ sync_resolve_return (tree params, tree r
    function should be called immediately after parsing the call expression
    before surrounding code has committed to the type of the expression.
 
+   LOC is the location of the builtin call.
+
    FUNCTION is the DECL that has been invoked; it is known to be a builtin.
    PARAMS is the argument list for the call.  The return value is non-null
    when expansion is complete, and null if normal processing should
    continue.  */
 
 tree
-resolve_overloaded_builtin (tree function, tree params)
+resolve_overloaded_builtin (location_t loc, tree function, tree params)
 {
   enum built_in_function orig_code = DECL_FUNCTION_CODE (function);
   switch (DECL_BUILT_IN_CLASS (function))
@@ -7941,7 +7965,7 @@ resolve_overloaded_builtin (tree functio
       break;
     case BUILT_IN_MD:
       if (targetm.resolve_overloaded_builtin)
-	return targetm.resolve_overloaded_builtin (function, params);
+	return targetm.resolve_overloaded_builtin (loc, function, params);
       else
 	return NULL_TREE;
     default:
@@ -7978,7 +8002,7 @@ resolve_overloaded_builtin (tree functio
 	if (!sync_resolve_params (function, new_function, params))
 	  return error_mark_node;
 
-	result = build_function_call (new_function, params);
+	result = build_function_call (loc, new_function, params);
 	if (orig_code != BUILT_IN_BOOL_COMPARE_AND_SWAP_N
 	    && orig_code != BUILT_IN_LOCK_RELEASE_N)
 	  result = sync_resolve_return (params, result);
Index: c-common.h
===================================================================
--- c-common.h	(revision 141983)
+++ c-common.h	(working copy)
@@ -682,7 +682,7 @@ extern const struct attribute_spec c_com
    TYPE_DEP indicates whether it depends on type of the function or not
    (i.e. __PRETTY_FUNCTION__).  */
 
-extern tree (*make_fname_decl) (tree, int);
+extern tree (*make_fname_decl) (location_t, tree, int);
 
 extern tree identifier_global_value (tree);
 extern void record_builtin_type (enum rid, const char *, tree);
@@ -807,7 +807,7 @@ extern void finish_file	(void);
   (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 0)
 
 extern void emit_local_var (tree);
-extern tree do_case (tree, tree);
+extern tree do_case (location_t, tree, tree);
 extern tree build_stmt (enum tree_code, ...);
 extern tree build_case_label (tree, tree, tree);
 
@@ -835,13 +835,13 @@ extern tree boolean_increment (enum tree
 
 extern int case_compare (splay_tree_key, splay_tree_key);
 
-extern tree c_add_case_label (splay_tree, tree, tree, tree, tree);
+extern tree c_add_case_label (location_t, splay_tree, tree, tree, tree, tree);
 
 extern void c_do_switch_warnings (splay_tree, location_t, tree, tree);
 
-extern tree build_function_call (tree, tree);
+extern tree build_function_call (location_t, tree, tree);
 
-extern tree resolve_overloaded_builtin (tree, tree);
+extern tree resolve_overloaded_builtin (location_t, tree, tree);
 
 extern tree finish_label_address_expr (tree, location_t);
 
Index: tree-switch-conversion.c
===================================================================
--- tree-switch-conversion.c	(revision 141983)
+++ tree-switch-conversion.c	(working copy)
@@ -482,7 +482,8 @@ build_one_array (gimple swtch, int num, 
   ctor = build_constructor (array_type, info.constructors[num]);
   TREE_CONSTANT (ctor) = true;
 
-  decl = build_decl (VAR_DECL, NULL_TREE, array_type);
+  decl = build_decl (gimple_location (swtch),
+		     VAR_DECL, NULL_TREE, array_type);
   TREE_STATIC (decl) = 1;
   DECL_INITIAL (decl) = ctor;
 
@@ -633,9 +634,9 @@ fix_phi_nodes (edge e1f, edge e2f, basic
 static void
 gen_inbound_check (gimple swtch)
 {
-  tree label_decl1 = create_artificial_label ();
-  tree label_decl2 = create_artificial_label ();
-  tree label_decl3 = create_artificial_label ();
+  tree label_decl1 = create_artificial_label (UNKNOWN_LOCATION);
+  tree label_decl2 = create_artificial_label (UNKNOWN_LOCATION);
+  tree label_decl3 = create_artificial_label (UNKNOWN_LOCATION);
   gimple label1, label2, label3;
 
   tree utype;
Index: tree-cfg.c
===================================================================
--- tree-cfg.c	(revision 141983)
+++ tree-cfg.c	(working copy)
@@ -309,7 +309,7 @@ factor_computed_gotos (void)
 
 	      /* Build a label for the new block which will contain the
 		 factored computed goto.  */
-	      factored_label_decl = create_artificial_label ();
+	      factored_label_decl = create_artificial_label (UNKNOWN_LOCATION);
 	      factored_computed_goto_label
 		= gimple_build_label (factored_label_decl);
 	      gsi_insert_after (&new_gsi, factored_computed_goto_label,
@@ -4645,7 +4645,7 @@ gimple_block_label (basic_block bb)
 	}
     }
 
-  label = create_artificial_label ();
+  label = create_artificial_label (UNKNOWN_LOCATION);
   stmt = gimple_build_label (label);
   gsi_insert_before (&s, stmt, GSI_NEW_STMT);
   return label;
@@ -5815,7 +5815,7 @@ new_label_mapper (tree decl, void *data)
   m = XNEW (struct tree_map);
   m->hash = DECL_UID (decl);
   m->base.from = decl;
-  m->to = create_artificial_label ();
+  m->to = create_artificial_label (UNKNOWN_LOCATION);
   LABEL_DECL_UID (m->to) = LABEL_DECL_UID (decl);
   if (LABEL_DECL_UID (m->to) >= cfun->cfg->last_label_uid)
     cfun->cfg->last_label_uid = LABEL_DECL_UID (m->to) + 1;
Index: ipa-struct-reorg.c
===================================================================
--- ipa-struct-reorg.c	(revision 141983)
+++ ipa-struct-reorg.c	(working copy)
@@ -2169,7 +2169,8 @@ create_new_var_1 (tree orig_decl, d_str 
       type = gen_struct_type (orig_decl, type); 
 
       if (is_global_var (orig_decl))
-	new_decl = build_decl (VAR_DECL, new_name, type); 
+	new_decl = build_decl (DECL_SOURCE_LOCATION (orig_decl),
+			       VAR_DECL, new_name, type); 
       else
 	{
 	  const char *name = new_name ? IDENTIFIER_POINTER (new_name) : NULL;
Index: c-parser.c
===================================================================
--- c-parser.c	(revision 141983)
+++ c-parser.c	(working copy)
@@ -1605,23 +1605,23 @@ c_parser_enum_specifier (c_parser *parse
   struct c_typespec ret;
   tree attrs;
   tree ident = NULL_TREE;
-  location_t ident_loc;
+  location_t enum_loc;
   gcc_assert (c_parser_next_token_is_keyword (parser, RID_ENUM));
   c_parser_consume_token (parser);
   attrs = c_parser_attributes (parser);
+  enum_loc = c_parser_peek_token (parser)->location;
   /* Set the location in case we create a decl now.  */
   c_parser_set_source_position_from_token (c_parser_peek_token (parser));
   if (c_parser_next_token_is (parser, CPP_NAME))
     {
       ident = c_parser_peek_token (parser)->value;
-      ident_loc = c_parser_peek_token (parser)->location;
       c_parser_consume_token (parser);
     }
   if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))
     {
       /* Parse an enum definition.  */
       struct c_enum_contents the_enum;
-      tree type = start_enum (&the_enum, ident);
+      tree type = start_enum (enum_loc, &the_enum, ident);
       tree postfix_attrs;
       /* We chain the enumerators in reverse order, then put them in
 	 forward order at the end.  */
@@ -1657,8 +1657,8 @@ c_parser_enum_specifier (c_parser *parse
 	    }
 	  else
 	    enum_value = NULL_TREE;
-	  enum_decl = build_enumerator (&the_enum, enum_id, enum_value, 
-					value_loc);
+	  enum_decl = build_enumerator (value_loc,
+	      				&the_enum, enum_id, enum_value);
 	  TREE_CHAIN (enum_decl) = values;
 	  values = enum_decl;
 	  seen_comma = false;
@@ -1696,13 +1696,13 @@ c_parser_enum_specifier (c_parser *parse
       ret.kind = ctsk_tagref;
       return ret;
     }
-  ret = parser_xref_tag (ENUMERAL_TYPE, ident);
+  ret = parser_xref_tag (enum_loc, ENUMERAL_TYPE, ident);
   /* In ISO C, enumerated types can be referred to only if already
      defined.  */
   if (pedantic && !COMPLETE_TYPE_P (ret.spec))
     {
       gcc_assert (ident);
-      pedwarn (ident_loc, OPT_pedantic,
+      pedwarn (enum_loc, OPT_pedantic,
 	       "ISO C forbids forward references to %<enum%> types");
     }
   return ret;
@@ -1754,6 +1754,7 @@ c_parser_struct_or_union_specifier (c_pa
   tree attrs;
   tree ident = NULL_TREE;
   enum tree_code code;
+  location_t loc;
   switch (c_parser_peek_token (parser)->keyword)
     {
     case RID_STRUCT:
@@ -1767,8 +1768,11 @@ c_parser_struct_or_union_specifier (c_pa
     }
   c_parser_consume_token (parser);
   attrs = c_parser_attributes (parser);
+
   /* Set the location in case we create a decl now.  */
   c_parser_set_source_position_from_token (c_parser_peek_token (parser));
+  loc = c_parser_peek_token (parser)->location;
+
   if (c_parser_next_token_is (parser, CPP_NAME))
     {
       ident = c_parser_peek_token (parser)->value;
@@ -1778,7 +1782,7 @@ c_parser_struct_or_union_specifier (c_pa
     {
       /* Parse a struct or union definition.  Start the scope of the
 	 tag before parsing components.  */
-      tree type = start_struct (code, ident);
+      tree type = start_struct (loc, code, ident);
       tree postfix_attrs;
       /* We chain the components in reverse order, then put them in
 	 forward order at the end.  Each struct-declaration may
@@ -1867,7 +1871,7 @@ c_parser_struct_or_union_specifier (c_pa
 	    }
 	}
       postfix_attrs = c_parser_attributes (parser);
-      ret.spec = finish_struct (type, nreverse (contents),
+      ret.spec = finish_struct (loc, type, nreverse (contents),
 				chainon (attrs, postfix_attrs));
       ret.kind = ctsk_tagdef;
       return ret;
@@ -1879,7 +1883,7 @@ c_parser_struct_or_union_specifier (c_pa
       ret.kind = ctsk_tagref;
       return ret;
     }
-  ret = parser_xref_tag (code, ident);
+  ret = parser_xref_tag (loc, code, ident);
   return ret;
 }
 
@@ -3497,14 +3501,14 @@ c_parser_label (c_parser *parser)
       if (c_parser_next_token_is (parser, CPP_COLON))
 	{
 	  c_parser_consume_token (parser);
-	  label = do_case (exp1, NULL_TREE);
+	  label = do_case (loc1, exp1, NULL_TREE);
 	}
       else if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
 	{
 	  c_parser_consume_token (parser);
 	  exp2 = c_parser_expr_no_commas (parser, NULL).value;
 	  if (c_parser_require (parser, CPP_COLON, "expected %<:%>"))
-	    label = do_case (exp1, exp2);
+	    label = do_case (loc1, exp1, exp2);
 	}
       else
 	c_parser_error (parser, "expected %<:%> or %<...%>");
@@ -3513,7 +3517,7 @@ c_parser_label (c_parser *parser)
     {
       c_parser_consume_token (parser);
       if (c_parser_require (parser, CPP_COLON, "expected %<:%>"))
-	label = do_case (NULL_TREE, NULL_TREE);
+	label = do_case (loc1, NULL_TREE, NULL_TREE);
     }
   else
     {
@@ -3707,11 +3711,11 @@ c_parser_statement_after_labels (c_parse
 	  goto expect_semicolon;
 	case RID_CONTINUE:
 	  c_parser_consume_token (parser);
-	  stmt = c_finish_bc_stmt (&c_cont_label, false);
+	  stmt = c_finish_bc_stmt (loc, &c_cont_label, false);
 	  goto expect_semicolon;
 	case RID_BREAK:
 	  c_parser_consume_token (parser);
-	  stmt = c_finish_bc_stmt (&c_break_label, true);
+	  stmt = c_finish_bc_stmt (loc, &c_break_label, true);
 	  goto expect_semicolon;
 	case RID_RETURN:
 	  c_parser_consume_token (parser);
@@ -5521,7 +5525,7 @@ c_parser_postfix_expression_after_paren_
 
   if (!flag_isoc99)
     pedwarn (start_loc, OPT_pedantic, "ISO C90 forbids compound literals");
-  expr.value = build_compound_literal (type, init.value);
+  expr.value = build_compound_literal (start_loc, type, init.value);
   expr.original_code = ERROR_MARK;
   return c_parser_postfix_expression_after_primary (parser, expr);
 }
@@ -5558,7 +5562,7 @@ c_parser_postfix_expression_after_primar
 	    exprlist = c_parser_expr_list (parser, true);
 	  c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
 				     "expected %<)%>");
-	  expr.value = build_function_call (expr.value, exprlist);
+	  expr.value = build_function_call (loc, expr.value, exprlist);
 	  expr.original_code = ERROR_MARK;
           if (warn_disallowed_functions)
             warn_if_disallowed_function_p (expr.value);
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 141983)
+++ config/i386/i386.c	(working copy)
@@ -6228,15 +6228,20 @@ ix86_build_builtin_va_list_abi (enum cal
     return build_pointer_type (char_type_node);
 
   record = (*lang_hooks.types.make_type) (RECORD_TYPE);
-  type_decl = build_decl (TYPE_DECL, get_identifier ("__va_list_tag"), record);
+  type_decl = build_decl (BUILTINS_LOCATION,
+			  TYPE_DECL, get_identifier ("__va_list_tag"), record);
 
-  f_gpr = build_decl (FIELD_DECL, get_identifier ("gp_offset"),
+  f_gpr = build_decl (BUILTINS_LOCATION,
+		      FIELD_DECL, get_identifier ("gp_offset"),
 		      unsigned_type_node);
-  f_fpr = build_decl (FIELD_DECL, get_identifier ("fp_offset"),
+  f_fpr = build_decl (BUILTINS_LOCATION,
+		      FIELD_DECL, get_identifier ("fp_offset"),
 		      unsigned_type_node);
-  f_ovf = build_decl (FIELD_DECL, get_identifier ("overflow_arg_area"),
+  f_ovf = build_decl (BUILTINS_LOCATION,
+		      FIELD_DECL, get_identifier ("overflow_arg_area"),
 		      ptr_type_node);
-  f_sav = build_decl (FIELD_DECL, get_identifier ("reg_save_area"),
+  f_sav = build_decl (BUILTINS_LOCATION,
+		      FIELD_DECL, get_identifier ("reg_save_area"),
 		      ptr_type_node);
 
   va_list_gpr_counter_field = f_gpr;
@@ -6627,8 +6632,8 @@ ix86_gimplify_va_arg (tree valist, tree 
       bool need_temp;
       tree int_addr, sse_addr;
 
-      lab_false = create_artificial_label ();
-      lab_over = create_artificial_label ();
+      lab_false = create_artificial_label (UNKNOWN_LOCATION);
+      lab_over = create_artificial_label (UNKNOWN_LOCATION);
 
       examine_argument (nat_mode, type, 0, &needed_intregs, &needed_sseregs);
 
@@ -7206,7 +7211,8 @@ ix86_file_end (void)
 	{
 	  tree decl;
 
-	  decl = build_decl (FUNCTION_DECL, get_identifier (name),
+	  decl = build_decl (BUILTINS_LOCATION,
+			     FUNCTION_DECL, get_identifier (name),
 			     error_mark_node);
 	  TREE_PUBLIC (decl) = 1;
 	  TREE_STATIC (decl) = 1;
@@ -9536,7 +9542,8 @@ get_dllimport_decl (tree decl)
   *loc = h = GGC_NEW (struct tree_map);
   h->hash = in.hash;
   h->base.from = decl;
-  h->to = to = build_decl (VAR_DECL, NULL, ptr_type_node);
+  h->to = to = build_decl (DECL_SOURCE_LOCATION (decl),
+			   VAR_DECL, NULL, ptr_type_node);
   DECL_ARTIFICIAL (to) = 1;
   DECL_IGNORED_P (to) = 1;
   DECL_EXTERNAL (to) = 1;
@@ -24493,7 +24500,8 @@ ix86_veclibabi_svml (enum built_in_funct
     fntype = build_function_type_list (type_out, type_in, type_in, NULL);
 
   /* Build a function declaration for the vectorized function.  */
-  new_fndecl = build_decl (FUNCTION_DECL, get_identifier (name), fntype);
+  new_fndecl = build_decl (BUILTINS_LOCATION,
+			   FUNCTION_DECL, get_identifier (name), fntype);
   TREE_PUBLIC (new_fndecl) = 1;
   DECL_EXTERNAL (new_fndecl) = 1;
   DECL_IS_NOVOPS (new_fndecl) = 1;
@@ -24577,7 +24585,8 @@ ix86_veclibabi_acml (enum built_in_funct
     fntype = build_function_type_list (type_out, type_in, type_in, NULL);
 
   /* Build a function declaration for the vectorized function.  */
-  new_fndecl = build_decl (FUNCTION_DECL, get_identifier (name), fntype);
+  new_fndecl = build_decl (BUILTINS_LOCATION,
+			   FUNCTION_DECL, get_identifier (name), fntype);
   TREE_PUBLIC (new_fndecl) = 1;
   DECL_EXTERNAL (new_fndecl) = 1;
   DECL_IS_NOVOPS (new_fndecl) = 1;
Index: stmt.c
===================================================================
--- stmt.c	(revision 141983)
+++ stmt.c	(working copy)
@@ -2935,7 +2935,9 @@ emit_case_nodes (rtx index, case_node_pt
 	      /* Neither node is bounded.  First distinguish the two sides;
 		 then emit the code for one side at a time.  */
 
-	      tree test_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
+	      tree test_label
+		= build_decl (CURR_INSN_LOCATION,
+			      LABEL_DECL, NULL_TREE, NULL_TREE);
 
 	      /* See if the value is on the right.  */
 	      emit_cmp_and_jump_insns (index,
@@ -3058,7 +3060,8 @@ emit_case_nodes (rtx index, case_node_pt
 	      /* Right hand node requires testing.
 		 Branch to a label where we will handle it later.  */
 
-	      test_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
+	      test_label = build_decl (CURR_INSN_LOCATION,
+				       LABEL_DECL, NULL_TREE, NULL_TREE);
 	      emit_cmp_and_jump_insns (index,
 				       convert_modes
 				       (mode, imode,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]