Patch for c/13801

Joseph S. Myers jsm@polyomino.org.uk
Mon Aug 2 21:28:00 GMT 2004


This patch fixes bug 13801, that when entities with external or
internal linkage are redeclared, their types in each block should only
depend on the visible declarations.  It also fixes some related cases
that may never have worked, and one regression from 3.3 perhaps of
more note: a static declaration at file scope didn't get merged with
an extern declaration at block scope.

This is the last known (to me) miscellaneous (aside from constant
expressions issues) C90 conformance issue, but I can't tell what
unknown issues there might be ((legitimate) access to third-party
conformance testsuites desired).

There are also some extra diagnostics for incompatible implicit
function declarations as part of making implicit function declarations
work properly if the previous declaration is out of scope.  For
discussion of that for incompatibly implicitly declaring a built-in
function, see <http://gcc.gnu.org/ml/gcc/2004-08/msg00021.html>.

An extra pointer in every c_binding structure may not be ideal, but I
don't have a better approach for tracking the shadowed types of
declarations.  My measurements of compile-time performance before and
after this patch (I didn't make measurements of memory consumption)
show a 2.6% _improvement_ in compile time (compiling a fixed set of .i
files of cc1 at -O0, checking-enabled compiler so not of great
significance), for which I don't have an explanation.

The special handling of shadowed types isn't added for static function
declarations at block scope, as it didn't seem worthwhile for a
doubtful extension (compile-time undefined behavior).  Also, an object
or function declared static at file scope and then receiving
incompatible completions of its type in non-overlapping block scopes
won't get that diagnosed, as it seemed excessive to add *two* pointers
to every c_binding to handle that and static declarations don't go in
the external_scope so don't have there to store to overall composite
type information for diagnosis of such compile-time undefined
behavior.

Bootstrapped with no regressions on i686-pc-linux-gnu.  I won't apply
this to mainline immediately in case there are any objections to the
approach or any further comments on the new warning.  Also, once
applied there will inevitably be target-specific tests which fail with
the new warning and need declarations of abort, exit and other
built-in functions added (generally the fixes are trivial, it's just
that there are a lot of them in this patch so probably quite a few
target-specific ones as well).

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2004-08-02  Joseph S. Myers  <jsm@polyomino.org.uk>

	PR c/13801
	* c-decl.c (struct c_binding): Add type element.
	(bind): Set type element.
	(pop_scope): Restore type of decl to the correct type from an
	outer scope.
	(pushdecl): Set type of external declaration at block scope based
	only on the visible declarations.  Save type when changing the
	type of a declaration.  Merge an external declaration at block
	scope with a visible static declaration at file scope.
	(implicitly_declare): Give recycled old declaration the new type
	except for incompatible declarations of built-in functions, saving
	the old type.  Diagnose incompatible implicit declarations.

testsuite:
2004-08-02  Joseph S. Myers  <jsm@polyomino.org.uk>

	PR c/13801
	* gcc.dg/redecl-3.c, gcc.dg/redecl-4.c, gcc.dg/redecl-5.c: New
	tests.
	* gcc.dg/format/attr-6.c: Expect warning for implicit declaration
	of scanf.
	* gcc.dg/20001023-1.c, gcc.dg/20001108-1.c, gcc.dg/20001117-1.c,
	gcc.dg/20010202-1.c, gcc.dg/20011008-2.c, gcc.dg/20011214-1.c,
	gcc.dg/20020201-1.c, gcc.dg/20020312-2.c, gcc.dg/20020426-2.c,
	gcc.dg/20030331-2.c, gcc.dg/20030612-1.c, gcc.dg/20030926-1.c,
	gcc.dg/20031216-1.c, gcc.dg/20031218-3.c, gcc.dg/20040305-2.c,
	gcc.dg/980226-1.c, gcc.dg/Wreturn-type2.c,
	gcc.dg/Wunreachable-6.c, gcc.dg/Wunreachable-7.c,
	gcc.dg/align-1.c, gcc.dg/builtin-prefetch-1.c,
	gcc.dg/builtins-17.c, gcc.dg/builtins-19.c, gcc.dg/builtins-2.c,
	gcc.dg/builtins-20.c, gcc.dg/builtins-21.c, gcc.dg/builtins-7.c,
	gcc.dg/builtins-8.c, gcc.dg/cpp/19930510-1.c,
	gcc.dg/cpp/charconst-3.c, gcc.dg/cpp/charconst-4.c,
	gcc.dg/cpp/mi6.c, gcc.dg/cpp/tr-paste.c, gcc.dg/cpp/trad/mi6.c,
	gcc.dg/cpp/trad/paste.c, gcc.dg/cpp/trad/strify.c,
	gcc.dg/fastmath-1.c, gcc.dg/fshort-wchar.c, gcc.dg/i386-387-7.c,
	gcc.dg/i386-387-8.c, gcc.dg/i386-asm-1.c, gcc.dg/i386-cadd.c,
	gcc.dg/i386-fpcvt-3.c, gcc.dg/i386-loop-3.c,
	gcc.dg/i386-memset-1.c, gcc.dg/loop-2.c, gcc.dg/nest.c,
	gcc.dg/noncompile/971104-1.c, gcc.dg/noncompile/990416-1.c,
	gcc.dg/noncompile/scope.c, gcc.dg/pack-test-4.c,
	gcc.dg/pack-test-5.c, gcc.dg/pch/inline-4.c, gcc.dg/postincr-1.c,
	gcc.dg/pr10392-1.c, gcc.dg/pragma-align.c,
	gcc.dg/profile-generate-1.c, gcc.dg/sibcall-1.c,
	gcc.dg/sibcall-2.c, gcc.dg/sibcall-3.c, gcc.dg/sibcall-4.c,
	gcc.dg/sibcall-5.c, gcc.dg/sibcall-6.c, gcc.dg/switch-warn-1.c,
	gcc.dg/switch-warn-2.c, gcc.dg/torture/builtin-attr-1.c,
	gcc.dg/torture/builtin-math-1.c, gcc.dg/torture/builtin-noret-2.c,
	gcc.dg/trampoline-1.c, gcc.dg/tree-ssa/20030703-1.c,
	gcc.dg/tree-ssa/20030703-2.c, gcc.dg/tree-ssa/20030708-1.c,
	gcc.dg/tree-ssa/20030709-3.c, gcc.dg/tree-ssa/20030710-1.c,
	gcc.dg/tree-ssa/20030711-1.c, gcc.dg/tree-ssa/20030729-1.c,
	gcc.dg/tree-ssa/20030730-1.c, gcc.dg/tree-ssa/20030730-2.c,
	gcc.dg/tree-ssa/20030731-1.c, gcc.dg/tree-ssa/20030807-11.c,
	gcc.dg/tree-ssa/20030807-2.c, gcc.dg/tree-ssa/20030807-5.c,
	gcc.dg/tree-ssa/20030807-7.c, gcc.dg/tree-ssa/20030808-1.c,
	gcc.dg/tree-ssa/20030814-1.c, gcc.dg/tree-ssa/20030814-2.c,
	gcc.dg/tree-ssa/20030814-3.c, gcc.dg/tree-ssa/20030814-4.c,
	gcc.dg/tree-ssa/20030814-5.c, gcc.dg/tree-ssa/20030814-6.c,
	gcc.dg/tree-ssa/20030814-7.c, gcc.dg/tree-ssa/20030815-1.c,
	gcc.dg/tree-ssa/20030907-1.c, gcc.dg/tree-ssa/20030917-3.c,
	gcc.dg/tree-ssa/20030922-1.c, gcc.dg/tree-ssa/20031113-1.c,
	gcc.dg/tree-ssa/20040121-1.c, gcc.dg/tree-ssa/20040319-1.c,
	gcc.dg/tree-ssa/20040324-1.c, gcc.dg/tree-ssa/20040326-1.c,
	gcc.dg/tree-ssa/20040326-2.c, gcc.dg/tree-ssa/20040517-1.c,
	gcc.dg/tree-ssa/ssa-ccp-10.c, gcc.dg/tree-ssa/ssa-pre-1.c,
	gcc.dg/tree-ssa/tailcall-1.c, gcc.dg/tree-ssa/tailrecursion-5.c,
	gcc.dg/ultrasp3.c, gcc.dg/winline-7.c, gcc.misc-tests/bprob-1.c,
	gcc.misc-tests/bprob-2.c, gcc.misc-tests/gcov-3.c,
	gcc.misc-tests/gcov-4.c, gcc.misc-tests/gcov-4b.c,
	gcc.misc-tests/gcov-6.c, gcc.misc-tests/gcov-7.c,
	gcc.misc-tests/i386-pf-3dnow-1.c,
	gcc.misc-tests/i386-pf-athlon-1.c,
	gcc.misc-tests/i386-pf-none-1.c, gcc.misc-tests/i386-pf-sse-1.c,
	objc.dg/nested-func-1.m, objc.dg/special/unclaimed-category-1.m:
	Declare built-in functions used.
	* gcc.dg/torture/builtin-attr-1.c (nexttoward): Use FPTEST2ARG2.

diff -rupN GCC.orig/gcc/c-decl.c GCC/gcc/c-decl.c
--- GCC.orig/gcc/c-decl.c	2004-07-31 17:18:48.000000000 +0000
+++ GCC/gcc/c-decl.c	2004-08-02 14:04:02.000000000 +0000
@@ -164,6 +164,14 @@ bool c_override_global_bindings_to_false
    suppress further errors about that identifier in the current
    function.
 
+   The ->type field stores the type of the declaration in this scope;
+   if NULL, the type is the type of the ->decl field.  This is only of
+   relevance for objects with external or internal linkage which may
+   be redeclared in inner scopes, forming composite types that only
+   persist for the duration of those scopes.  In the external scope,
+   this stores the composite of all the types declared for this
+   object, visible or not.
+
    The depth field is copied from the scope structure that holds this
    decl.  It is used to preserve the proper ordering of the ->shadowed
    field (see bind()) and also for a handful of special-case checks.
@@ -176,6 +184,7 @@ bool c_override_global_bindings_to_false
 struct c_binding GTY((chain_next ("%h.prev")))
 {
   tree decl;			/* the decl bound */
+  tree type;			/* the type in this scope */
   tree id;			/* the identifier it's bound to */
   struct c_binding *prev;	/* the previous decl in this scope */
   struct c_binding *shadowed;	/* the innermost decl shadowed by this one */
@@ -437,6 +446,8 @@ bind (tree name, tree decl, struct c_sco
   b->invisible = invisible;
   b->nested = nested;
 
+  b->type = 0;
+
   b->prev = scope->bindings;
   scope->bindings = b;
 
@@ -797,6 +808,8 @@ pop_scope (void)
 	      if (I_SYMBOL_BINDING (b->id) != b) abort ();
 #endif
 	      I_SYMBOL_BINDING (b->id) = b->shadowed;
+	      if (b->shadowed && b->shadowed->type)
+		TREE_TYPE (b->shadowed->decl) = b->shadowed->type;
 	    }
 	  break;
 
@@ -1915,13 +1928,40 @@ pushdecl (tree x)
      have compatible type; otherwise, the behavior is undefined.)  */
   if (DECL_EXTERNAL (x) || scope == file_scope)
     {
+      tree type = TREE_TYPE (x);
+      tree vistype = 0;
+      tree visdecl = 0;
+      if (b && !B_IN_EXTERNAL_SCOPE (b)
+	  && (TREE_CODE (b->decl) == FUNCTION_DECL
+	      || TREE_CODE (b->decl) == VAR_DECL)
+	  && DECL_FILE_SCOPE_P (b->decl))
+	{
+	  visdecl = b->decl;
+	  vistype = TREE_TYPE (visdecl);
+	}
       if (warn_nested_externs
 	  && scope != file_scope
 	  && !DECL_IN_SYSTEM_HEADER (x))
 	warning ("nested extern declaration of '%D'", x);
 
       while (b && !B_IN_EXTERNAL_SCOPE (b))
-	b = b->shadowed;
+	{
+	  /* If this decl might be modified and its type hasn't been
+	     saved, save its type.  This is done here rather than when
+	     the decl is first bound because attributes may be added
+	     to the type after first binding.  */
+	  if (DECL_FILE_SCOPE_P (b->decl) && !b->type)
+	    b->type = TREE_TYPE (b->decl);
+	  b = b->shadowed;
+	}
+
+      /* If a matching external declaration has been found, set its
+	 type to the composite of all the types of that declaration.
+	 After the consistency checks, it will be reset to the
+	 composite of the visible types only.  */
+      if (b && (TREE_PUBLIC (x) || same_translation_unit_p (x, b->decl))
+	  && b->type)
+	TREE_TYPE (b->decl) = b->type;
 
       /* The point of the same_translation_unit_p check here is,
 	 we want to detect a duplicate decl for a construct like
@@ -1932,13 +1972,34 @@ pushdecl (tree x)
 	  && (TREE_PUBLIC (x) || same_translation_unit_p (x, b->decl))
 	  && duplicate_decls (x, b->decl))
 	{
+	  tree thistype;
+	  thistype = (vistype ? composite_type (vistype, type) : type);
+	  b->type = TREE_TYPE (b->decl);
+	  if (TREE_CODE (b->decl) == FUNCTION_DECL && DECL_BUILT_IN (b->decl))
+	    thistype
+	      = build_type_attribute_variant (thistype,
+					      TYPE_ATTRIBUTES (b->type));
+	  TREE_TYPE (b->decl) = thistype;
 	  bind (name, b->decl, scope, /*invisible=*/false, /*nested=*/true);
 	  return b->decl;
 	}
       else if (TREE_PUBLIC (x))
 	{
-	  bind (name, x, external_scope, /*invisible=*/true, /*nested=*/false);
-	  nested = true;
+	  if (visdecl && !b && duplicate_decls (x, visdecl))
+	    {
+	      /* An external declaration at block scope referring to a
+		 visible entity with internal linkage.  The composite
+		 type will already be correct for this scope, so we
+		 just need to fall through to make the declaration in
+		 this scope.  */
+	      nested = true;
+	    }
+	  else
+	    {
+	      bind (name, x, external_scope, /*invisible=*/true,
+		    /*nested=*/false);
+	      nested = true;
+	    }
 	}
     }
   /* Similarly, a declaration of a function with static linkage at
@@ -2056,7 +2117,16 @@ implicit_decl_warning (tree id, tree old
 tree
 implicitly_declare (tree functionid)
 {
-  tree decl = lookup_name_in_scope (functionid, external_scope);
+  struct c_binding *b;
+  tree decl = 0;
+  for (b = I_SYMBOL_BINDING (functionid); b; b = b->shadowed)
+    {
+      if (B_IN_SCOPE (b, external_scope))
+	{
+	  decl = b->decl;
+	  break;
+	}
+    }
 
   if (decl)
     {
@@ -2073,15 +2143,42 @@ implicitly_declare (tree functionid)
 	}
       else
 	{
+	  tree newtype = default_function_type;
+	  if (b->type)
+	    TREE_TYPE (decl) = b->type;
 	  /* Implicit declaration of a function already declared
 	     (somehow) in a different scope, or as a built-in.
 	     If this is the first time this has happened, warn;
-	     then recycle the old declaration.  */
+	     then recycle the old declaration but with the new type.  */
 	  if (!C_DECL_IMPLICIT (decl))
 	    {
 	      implicit_decl_warning (functionid, decl);
 	      C_DECL_IMPLICIT (decl) = 1;
 	    }
+	  if (DECL_BUILT_IN (decl))
+	    {
+	      newtype = build_type_attribute_variant (newtype,
+						      TYPE_ATTRIBUTES
+						      (TREE_TYPE (decl)));
+	      if (!comptypes (newtype, TREE_TYPE (decl)))
+		{
+		  warning ("incompatible implicit declaration of built-in"
+			   " function %qD", decl);
+		  newtype = TREE_TYPE (decl);
+		}
+	    }
+	  else
+	    {
+	      if (!comptypes (newtype, TREE_TYPE (decl)))
+		{
+		  error ("incompatible implicit declaration of function %qD",
+			 decl);
+		  locate_old_decl (decl, error);
+		}
+	    }
+	  if (!b->type)
+	    b->type = TREE_TYPE (decl);
+	  TREE_TYPE (decl) = newtype;
 	  bind (functionid, decl, current_scope,
 		/*invisible=*/false, /*nested=*/true);
 	  return decl;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20001023-1.c GCC/gcc/testsuite/gcc.dg/20001023-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20001023-1.c	2002-01-09 21:34:32.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20001023-1.c	2004-08-01 21:09:36.000000000 +0000
@@ -1,6 +1,9 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -fomit-frame-pointer" } */
 
+extern void abort (void);
+extern void exit (int);
+
 unsigned char a[256], b[256], c[256], d[256];
 
 void foo(unsigned char *x, int y, unsigned char *z)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20001108-1.c GCC/gcc/testsuite/gcc.dg/20001108-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20001108-1.c	2000-11-09 09:31:48.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20001108-1.c	2004-08-01 21:09:43.000000000 +0000
@@ -1,6 +1,9 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -fomit-frame-pointer" } */
 
+extern void abort (void);
+extern void exit (int);
+
 void die (long) __attribute__ ((noreturn));
 
 void die (long e)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20001117-1.c GCC/gcc/testsuite/gcc.dg/20001117-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20001117-1.c	2000-12-29 19:45:29.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20001117-1.c	2004-08-01 21:09:51.000000000 +0000
@@ -1,6 +1,9 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -finstrument-functions" } */
 
+extern void abort (void);
+extern void exit (int);
+
 double
 foo (double a, double b)
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20010202-1.c GCC/gcc/testsuite/gcc.dg/20010202-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20010202-1.c	2001-02-07 22:04:10.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20010202-1.c	2004-08-01 21:09:58.000000000 +0000
@@ -1,6 +1,9 @@
 /* { dg-do compile { target i?86-*-* sparc*-*-* } } */
 /* { dg-options "-O2" } */
 
+extern void abort (void);
+extern void exit (int);
+
 typedef enum { false, true } __attribute__ ((packed)) boolean;
 typedef struct {
   enum {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20011008-2.c GCC/gcc/testsuite/gcc.dg/20011008-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/20011008-2.c	2001-10-08 19:42:40.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20011008-2.c	2004-08-01 21:10:06.000000000 +0000
@@ -1,6 +1,9 @@
 /* { dg-do run } */
 /* { dg-options "-O0" } */
 
+extern void abort (void);
+extern void exit (int);
+
 struct { union {int x; int y;}; int q; } b;
 union { struct {int x;}; int q; } e;
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20011214-1.c GCC/gcc/testsuite/gcc.dg/20011214-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20011214-1.c	2001-12-15 04:04:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20011214-1.c	2004-08-01 21:10:18.000000000 +0000
@@ -1,5 +1,8 @@
 /* { dg-do run } */
 
+extern void abort (void);
+extern void exit (int);
+
 #define small   __attribute__((mode(QI))) int
 int main()
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20020201-1.c GCC/gcc/testsuite/gcc.dg/20020201-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20020201-1.c	2002-02-01 19:01:55.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20020201-1.c	2004-08-01 21:10:33.000000000 +0000
@@ -7,6 +7,9 @@
 /* { dg-options "-fprofile-arcs" } */
 /* { dg-do run { target native } } */
 
+extern void abort (void);
+extern void exit (int);
+
 int rand (void);
 void srand (unsigned int seed);
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20020312-2.c GCC/gcc/testsuite/gcc.dg/20020312-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/20020312-2.c	2004-02-04 20:23:47.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20020312-2.c	2004-08-01 21:11:00.000000000 +0000
@@ -8,6 +8,8 @@
 /* { dg-do run } */
 /* { dg-options "-O -fno-pic" } */
 
+extern void abort (void);
+
 #if defined(__alpha__)
 /* PIC register is $29, but is used even without -fpic.  */
 #elif defined(__arc__)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20020426-2.c GCC/gcc/testsuite/gcc.dg/20020426-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/20020426-2.c	2004-07-15 08:36:18.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20020426-2.c	2004-08-01 21:11:35.000000000 +0000
@@ -4,6 +4,8 @@
 /* { dg-options "-O2" } */
 /* { dg-options "-O2 -frename-registers -fomit-frame-pointer -fPIC -mtune=i686" { target i?86-*-* } } */
 
+extern void exit (int);
+
 typedef struct
 {
   union
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20030331-2.c GCC/gcc/testsuite/gcc.dg/20030331-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/20030331-2.c	2003-04-01 07:32:22.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20030331-2.c	2004-08-01 21:11:54.000000000 +0000
@@ -1,5 +1,7 @@
 // { dg-options "" }
 
+extern int printf (const char *, ...);
+
 int foo() {
   int yd;
   float in[1][yd];
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20030612-1.c GCC/gcc/testsuite/gcc.dg/20030612-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20030612-1.c	2004-06-16 08:10:58.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20030612-1.c	2004-08-01 21:12:14.000000000 +0000
@@ -1,6 +1,8 @@
 /* { dg-do run } */
 /* { dg-options "-O2" } */
 
+extern void abort (void);
+
 int A, B;
 
 void foo()
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20030926-1.c GCC/gcc/testsuite/gcc.dg/20030926-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20030926-1.c	2003-11-12 12:24:08.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20030926-1.c	2004-08-01 21:12:57.000000000 +0000
@@ -3,6 +3,9 @@
 /* { dg-options "-O2 -minline-all-stringops" } */
 /* { dg-options "-O2 -minline-all-stringops -march=pentium4" { target i?86-*-* } } */
 
+extern void *memcpy (void *, const void *, __SIZE_TYPE__);
+extern __SIZE_TYPE__ strlen (const char *);
+
 void
 foo (char *p)
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20031216-1.c GCC/gcc/testsuite/gcc.dg/20031216-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20031216-1.c	2003-12-18 12:15:37.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20031216-1.c	2004-08-01 21:13:13.000000000 +0000
@@ -4,6 +4,8 @@
 /* { dg-options "-O2" } */
 /* { dg-options "-O2 -fPIC" { target s390*-*-* } } */
 
+extern void abort (void);
+
 int count = 0;
 char *str;
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20031218-3.c GCC/gcc/testsuite/gcc.dg/20031218-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/20031218-3.c	2003-12-18 22:19:11.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20031218-3.c	2004-08-01 21:13:29.000000000 +0000
@@ -5,6 +5,8 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -g" } */
 
+extern __SIZE_TYPE__ strlen (const char *);
+
 int x (char *s)
 {
   int y () { return (strlen (s)); }
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20040305-2.c GCC/gcc/testsuite/gcc.dg/20040305-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/20040305-2.c	2004-03-13 11:18:50.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20040305-2.c	2004-08-01 21:13:48.000000000 +0000
@@ -1,6 +1,8 @@
 /* PR target/14262 */
 /* { dg-do run } */
 
+extern void abort (void);
+
 typedef char   ACS;
 typedef char   LSM;
 typedef char   PANEL;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/980226-1.c GCC/gcc/testsuite/gcc.dg/980226-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/980226-1.c	1998-12-16 22:23:05.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/980226-1.c	2004-08-01 21:14:01.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile { target i?86-*-* } } */
 /* { dg-options -O2 } */
 
+extern int printf (const char *, ...);
 extern double bar (double);
 
 int
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/Wreturn-type2.c GCC/gcc/testsuite/gcc.dg/Wreturn-type2.c
--- GCC.orig/gcc/testsuite/gcc.dg/Wreturn-type2.c	2002-02-07 12:36:46.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/Wreturn-type2.c	2004-08-01 21:14:18.000000000 +0000
@@ -2,6 +2,8 @@
    missing return.  */
 /* { dg-do compile } */
 
+extern void abort (void);
+
 f() {}				/* { dg-bogus "" "no return warning" } */
 int g() { abort (); }		/* { dg-bogus "" "no return warning" } */
 int main() {}			/* { dg-bogus "" "no return warning" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/Wunreachable-6.c GCC/gcc/testsuite/gcc.dg/Wunreachable-6.c
--- GCC.orig/gcc/testsuite/gcc.dg/Wunreachable-6.c	2003-07-09 01:17:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/Wunreachable-6.c	2004-08-01 21:14:37.000000000 +0000
@@ -2,6 +2,9 @@
 /* { dg-do compile } */
 /* { dg-options "-Wunreachable-code" } */
 
+extern int printf (const char *, ...);
+extern void exit (int);
+
 int main(int argc, char *argv[])
 {
   if (argc != 1)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/Wunreachable-7.c GCC/gcc/testsuite/gcc.dg/Wunreachable-7.c
--- GCC.orig/gcc/testsuite/gcc.dg/Wunreachable-7.c	2003-07-09 01:17:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/Wunreachable-7.c	2004-08-01 21:14:54.000000000 +0000
@@ -2,6 +2,9 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -Wunreachable-code" } */
 
+extern int printf (const char *, ...);
+extern void exit (int);
+
 int main(int argc, char *argv[])
 {
   if (argc != 1)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/align-1.c GCC/gcc/testsuite/gcc.dg/align-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/align-1.c	2003-04-02 15:50:31.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/align-1.c	2004-08-01 21:15:05.000000000 +0000
@@ -6,6 +6,8 @@
    { dg-options "" }
 */
 
+extern void abort (void);
+
 struct A
 {
   char c;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/builtin-prefetch-1.c GCC/gcc/testsuite/gcc.dg/builtin-prefetch-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/builtin-prefetch-1.c	2001-12-04 00:56:33.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/builtin-prefetch-1.c	2004-08-01 21:15:20.000000000 +0000
@@ -5,6 +5,8 @@
 
 /* { dg-do run } */
 
+extern void exit (int);
+
 enum locality { none, low, moderate, high, bogus };
 enum rw { read, write };
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/builtins-17.c GCC/gcc/testsuite/gcc.dg/builtins-17.c
--- GCC.orig/gcc/testsuite/gcc.dg/builtins-17.c	2003-06-04 12:20:40.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/builtins-17.c	2004-08-01 21:15:50.000000000 +0000
@@ -11,7 +11,7 @@
 extern void link_error(void);
 
 extern double exp(double);
-
+extern double atan(double);
 
 int main()
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/builtins-19.c GCC/gcc/testsuite/gcc.dg/builtins-19.c
--- GCC.orig/gcc/testsuite/gcc.dg/builtins-19.c	2003-06-06 16:15:50.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/builtins-19.c	2004-08-01 21:16:30.000000000 +0000
@@ -10,6 +10,9 @@
 double cabs (__complex__ double);
 float cabsf (__complex__ float);
 long double cabsl (__complex__ long double);
+double fabs (double);
+float fabsf (float);
+long double fabsl (long double);
 
 void link_error (void);
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/builtins-2.c GCC/gcc/testsuite/gcc.dg/builtins-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/builtins-2.c	2003-10-04 07:36:32.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/builtins-2.c	2004-08-02 17:17:26.000000000 +0000
@@ -8,6 +8,28 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -ffast-math" } */
 
+extern double atan (double);
+extern float atanf (float);
+extern long double atanl (long double);
+extern double exp (double);
+extern float expf (float);
+extern long double expl (long double);
+extern double fabs (double);
+extern float fabsf (float);
+extern long double fabsl (long double);
+extern double log (double);
+extern float logf (float);
+extern long double logl (long double);
+extern double pow (double, double);
+extern float powf (float, float);
+extern long double powl (long double, long double);
+extern double sqrt (double);
+extern float sqrtf (float);
+extern long double sqrtl (long double);
+extern double tan (double);
+extern float tanf (float);
+extern long double tanl (long double);
+
 double test1(double x)
 {
   return log(exp(x));
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/builtins-20.c GCC/gcc/testsuite/gcc.dg/builtins-20.c
--- GCC.orig/gcc/testsuite/gcc.dg/builtins-20.c	2003-12-24 20:10:04.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/builtins-20.c	2004-08-01 21:37:12.000000000 +0000
@@ -10,6 +10,16 @@
 
 #include "builtins-config.h"
 
+extern double cos (double);
+extern double sin (double);
+extern double tan (double);
+extern float cosf (float);
+extern float sinf (float);
+extern float tanf (float);
+extern long double cosl (long double);
+extern long double sinl (long double);
+extern long double tanl (long double);
+
 extern void link_error(void);
 
 void test1(double x)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/builtins-21.c GCC/gcc/testsuite/gcc.dg/builtins-21.c
--- GCC.orig/gcc/testsuite/gcc.dg/builtins-21.c	2003-06-12 12:53:01.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/builtins-21.c	2004-08-01 21:38:06.000000000 +0000
@@ -8,6 +8,16 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -ffast-math" } */
 
+extern double fabs (double);
+extern float fabsf (float);
+extern long double fabsl (long double);
+extern double sqrt (double);
+extern float sqrtf (float);
+extern long double sqrtl (long double);
+extern double exp (double);
+extern float expf (float);
+extern long double expl (long double);
+
 double test1(double x)
 {
   return fabs(x*x);
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/builtins-7.c GCC/gcc/testsuite/gcc.dg/builtins-7.c
--- GCC.orig/gcc/testsuite/gcc.dg/builtins-7.c	2003-06-04 12:20:39.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/builtins-7.c	2004-08-02 17:18:20.000000000 +0000
@@ -8,6 +8,16 @@
 /* { dg-do link } */
 /* { dg-options "-O2 -ffast-math" } */
 
+extern double pow (double, double);
+extern float powf (float, float);
+extern long double powl (long double, long double);
+extern double tan (double);
+extern float tanf (float);
+extern long double tanl (long double);
+extern double atan (double);
+extern float atanf (float);
+extern long double atanl (long double);
+
 extern void link_error(void);
 
 void test(double x)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/builtins-8.c GCC/gcc/testsuite/gcc.dg/builtins-8.c
--- GCC.orig/gcc/testsuite/gcc.dg/builtins-8.c	2003-03-31 14:30:29.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/builtins-8.c	2004-08-02 17:18:29.000000000 +0000
@@ -9,6 +9,8 @@
 /* { dg-options "-O2 -ffast-math" } */
 
 extern void abort(void);
+extern double pow(double, double);
+extern double sqrt(double);
 
 void test(double x)
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/19930510-1.c GCC/gcc/testsuite/gcc.dg/cpp/19930510-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/19930510-1.c	2000-06-29 03:10:01.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/19930510-1.c	2004-08-01 20:45:59.000000000 +0000
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 
+extern void exit (int);
+
 #define ugly 3
 #ugly "foobar" 3	/* { dg-error "invalid" "invalid directive" } */
 int main() { exit (0); }
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/charconst-3.c GCC/gcc/testsuite/gcc.dg/cpp/charconst-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/charconst-3.c	2002-05-06 22:53:10.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/charconst-3.c	2004-08-01 20:46:15.000000000 +0000
@@ -9,6 +9,8 @@
 
 #include <limits.h>
 
+extern void abort (void);
+
 int main ()
 {
   /* These tests require at least 2-byte ints.  8-)  */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/charconst-4.c GCC/gcc/testsuite/gcc.dg/cpp/charconst-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/charconst-4.c	2002-05-08 21:02:31.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/charconst-4.c	2004-08-01 20:46:27.000000000 +0000
@@ -13,6 +13,8 @@
 
 #include <limits.h>
 
+extern void abort (void);
+
 #if INT_MAX == 32767
 # define LONG_CHARCONST '!\234a'
 # define SHORT_CHARCONST '\234a'
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/mi6.c GCC/gcc/testsuite/gcc.dg/cpp/mi6.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/mi6.c	2001-11-23 09:43:13.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/mi6.c	2004-08-01 20:46:41.000000000 +0000
@@ -5,6 +5,8 @@
 /* { dg-do compile } */
 /* { dg-options "" } */
 
+extern void abort (void);
+
 /* Each include file should not be subject to MI optimisation, since
    macro definitions can change.  Each header increments the variable
    VAR if it is defined.
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/tr-paste.c GCC/gcc/testsuite/gcc.dg/cpp/tr-paste.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/tr-paste.c	2001-11-18 17:13:19.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/tr-paste.c	2004-08-01 20:47:04.000000000 +0000
@@ -5,6 +5,8 @@
 /* { dg-do compile } */
 /* { dg-options "-traditional-cpp" } */
 
+extern int printf (const char *, ...);
+
 #define A(name) X/**/name
 
 #define B(name) \
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/trad/mi6.c GCC/gcc/testsuite/gcc.dg/cpp/trad/mi6.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/trad/mi6.c	2002-06-25 06:00:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/trad/mi6.c	2004-08-01 20:47:18.000000000 +0000
@@ -5,6 +5,8 @@
 /* { dg-do compile } */
 /* { dg-options "" } */
 
+extern void abort (void);
+
 /* Each include file should not be subject to MI optimisation, since
    macro definitions can change.  Each header increments the variable
    VAR if it is defined.
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/trad/paste.c GCC/gcc/testsuite/gcc.dg/cpp/trad/paste.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/trad/paste.c	2002-06-21 05:29:09.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/trad/paste.c	2004-08-01 20:47:29.000000000 +0000
@@ -4,6 +4,8 @@
 
 /* { dg-do compile } */
 
+extern int printf (const char *, ...);
+
 #define A(name) X/**/name
 
 #define B(name) \
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/trad/strify.c GCC/gcc/testsuite/gcc.dg/cpp/trad/strify.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/trad/strify.c	2002-06-21 05:29:09.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/trad/strify.c	2004-08-01 20:47:40.000000000 +0000
@@ -4,6 +4,7 @@
 #define foo(a, b) c="a"; d="b";
 
 extern void abort ();
+extern void exit (int);
 
 int main ()
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/fastmath-1.c GCC/gcc/testsuite/gcc.dg/fastmath-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/fastmath-1.c	2002-10-23 17:05:02.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/fastmath-1.c	2004-08-01 21:17:16.000000000 +0000
@@ -1,6 +1,8 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -ffast-math" } */
 
+extern void abort (void);
+
 int foo ( float* dists,  int k) 
 { 
 if ( ( dists [ 0 ] > 0 ) == ( dists [ 1 ] > 0 ) ) 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/attr-6.c GCC/gcc/testsuite/gcc.dg/format/attr-6.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/attr-6.c	2001-10-02 07:07:23.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/attr-6.c	2004-08-01 21:08:51.000000000 +0000
@@ -18,4 +18,5 @@ void
 foo (const char *s, int *p)
 {
   scanf("%ld", p); /* { dg-warning "format" "implicit scanf" } */
+  /* { dg-warning "implicit" "implicit decl warning" { target *-*-* } 20 } */
 }
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/fshort-wchar.c GCC/gcc/testsuite/gcc.dg/fshort-wchar.c
--- GCC.orig/gcc/testsuite/gcc.dg/fshort-wchar.c	2002-12-11 06:36:17.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/fshort-wchar.c	2004-08-01 21:17:29.000000000 +0000
@@ -7,6 +7,8 @@
 
    Test that __WCHAR_MAX__ is correct with -fshort-wchar.  */
 
+extern void abort (void);
+
 int main ()
 {
   __WCHAR_TYPE__ w = ~(__WCHAR_TYPE__) 0;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/i386-387-7.c GCC/gcc/testsuite/gcc.dg/i386-387-7.c
--- GCC.orig/gcc/testsuite/gcc.dg/i386-387-7.c	2004-04-14 02:37:29.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/i386-387-7.c	2004-08-01 21:17:52.000000000 +0000
@@ -3,6 +3,9 @@
 /* { dg-options "-O -ffast-math -march=i686" } */
 /* { dg-final { scan-assembler "fsincos" } } */
 
+extern double sin (double);
+extern double cos (double);
+
 double f1(double x)
 {
   return sin(x) + cos (x);
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/i386-387-8.c GCC/gcc/testsuite/gcc.dg/i386-387-8.c
--- GCC.orig/gcc/testsuite/gcc.dg/i386-387-8.c	2004-04-14 02:37:29.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/i386-387-8.c	2004-08-01 21:27:46.000000000 +0000
@@ -5,6 +5,8 @@
 /* { dg-final { scan-assembler "fptan" } } */
 /* { dg-final { scan-assembler-not "fld1" } } */
 
+extern double tan (double);
+
 double f1(double x)
 {
   return 1.0 / tan(x);
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/i386-asm-1.c GCC/gcc/testsuite/gcc.dg/i386-asm-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/i386-asm-1.c	2004-02-27 10:54:47.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/i386-asm-1.c	2004-08-01 21:28:07.000000000 +0000
@@ -2,6 +2,7 @@
 /* { dg-do run { target i?86-*-* } } */
 /* { dg-options "-O2" } */
 
+extern void abort (void);
 static int bar(int x) __asm__("bar") __attribute__((regparm(1)));
 static int __attribute__((regparm(1), noinline, used))
 bar(int x)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/i386-cadd.c GCC/gcc/testsuite/gcc.dg/i386-cadd.c
--- GCC.orig/gcc/testsuite/gcc.dg/i386-cadd.c	2003-02-04 21:26:17.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/i386-cadd.c	2004-08-01 21:28:23.000000000 +0000
@@ -2,6 +2,8 @@
 /* { dg-options "-O2 -march=k8" } */
 /* { dg-final { scan-assembler "sbb" } } */
 
+extern void abort (void);
+
 /* Conditional increment is best done using sbb $-1, val.  */
 int t[]={0,0,0,0,1,1,1,1,1,1};
 q()
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/i386-fpcvt-3.c GCC/gcc/testsuite/gcc.dg/i386-fpcvt-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/i386-fpcvt-3.c	2003-02-04 21:26:17.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/i386-fpcvt-3.c	2004-08-01 21:28:49.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
 /* { dg-options "-O2 -msse2 -march=k8" } */
 /* { dg-final { scan-assembler-not "cvtss2sd" } } */
+extern double fabs (double);
 float a,b;
 main()
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/i386-loop-3.c GCC/gcc/testsuite/gcc.dg/i386-loop-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/i386-loop-3.c	2003-06-01 16:10:09.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/i386-loop-3.c	2004-08-01 21:29:35.000000000 +0000
@@ -4,6 +4,9 @@
 /* { dg-do run { target i?86-*-* } } */
 /* { dg-options "-mtune=k6 -O3 -ffast-math -funroll-loops" } */
 
+extern void *memset (void *, int, __SIZE_TYPE__);
+extern void abort (void);
+
 typedef struct
 {
         unsigned char colormod;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/i386-memset-1.c GCC/gcc/testsuite/gcc.dg/i386-memset-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/i386-memset-1.c	2002-04-26 00:09:43.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/i386-memset-1.c	2004-08-01 21:30:12.000000000 +0000
@@ -10,6 +10,10 @@
 /* { dg-do run { target "i?86-*-*" } } */
 /* { dg-options "-O2 -minline-all-stringops" } */
 
+extern void *memset (void *, int, __SIZE_TYPE__);
+extern void abort (void);
+extern void exit (int);
+
 #ifndef MAX_OFFSET
 #define MAX_OFFSET (sizeof (long long))
 #endif
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/loop-2.c GCC/gcc/testsuite/gcc.dg/loop-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/loop-2.c	2003-03-26 12:48:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/loop-2.c	2004-08-01 21:30:29.000000000 +0000
@@ -3,6 +3,9 @@
    0 iterations of the loop rather than the correct 1.  */
 /* { dg-do run } */
 
+extern void abort (void);
+extern void exit (int);
+
 __inline__ int tag() { return 0; }
 
 void f ();
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/nest.c GCC/gcc/testsuite/gcc.dg/nest.c
--- GCC.orig/gcc/testsuite/gcc.dg/nest.c	2004-02-21 11:02:55.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/nest.c	2004-08-01 21:30:46.000000000 +0000
@@ -6,6 +6,8 @@
 /* { dg-error "profiler" "No profiler support" { target xstormy16-*-* } 0 } */
 /* { dg-error "-pg not supported" "Profiler support missing" { target *-*-sco3.2v5* } 0 } */
 
+extern void abort (void);
+
 long foo (long x)
 {
   long i, sum = 0;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/noncompile/971104-1.c GCC/gcc/testsuite/gcc.dg/noncompile/971104-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/noncompile/971104-1.c	2003-02-04 00:27:55.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/noncompile/971104-1.c	2004-08-01 20:48:23.000000000 +0000
@@ -1,3 +1,4 @@
+extern int printf(const char *, ...);
 typedef unsigned short          ushort;
 struct sembuf {
   ushort  sem_num;         
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/noncompile/990416-1.c GCC/gcc/testsuite/gcc.dg/noncompile/990416-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/noncompile/990416-1.c	2003-02-04 00:27:55.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/noncompile/990416-1.c	2004-08-01 20:48:58.000000000 +0000
@@ -1,3 +1,4 @@
+extern void *memcpy (void *, const void *, __SIZE_TYPE__);
 typedef int word_type;
    
 static void
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/noncompile/scope.c GCC/gcc/testsuite/gcc.dg/noncompile/scope.c
--- GCC.orig/gcc/testsuite/gcc.dg/noncompile/scope.c	2003-04-15 01:37:03.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/noncompile/scope.c	2004-08-01 20:49:18.000000000 +0000
@@ -1,3 +1,5 @@
+extern void abort (void);
+extern void exit (int);
 static int v = 3;
 
 f ()
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/pack-test-4.c GCC/gcc/testsuite/gcc.dg/pack-test-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/pack-test-4.c	2003-10-15 02:37:10.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/pack-test-4.c	2004-08-01 21:31:02.000000000 +0000
@@ -3,6 +3,8 @@
    { dg-options "" }
    { dg-do run } */
 
+extern void abort (void);
+
 typedef unsigned char uint8_t;
 
 typedef struct {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/pack-test-5.c GCC/gcc/testsuite/gcc.dg/pack-test-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/pack-test-5.c	2003-10-20 22:01:58.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/pack-test-5.c	2004-08-01 21:31:12.000000000 +0000
@@ -2,6 +2,8 @@
    of a field.  */
 /* { dg-do run } */
 
+extern void abort (void);
+
 struct A {
   double d;
 } __attribute__ ((aligned));
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/pch/inline-4.c GCC/gcc/testsuite/gcc.dg/pch/inline-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/pch/inline-4.c	2003-07-15 05:21:37.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/pch/inline-4.c	2004-08-02 17:11:10.000000000 +0000
@@ -1,4 +1,5 @@
 #include "inline-4.h"
+extern int printf (const char *, ...);
 int main(void) {
   printf (getstring());
   return 0;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/postincr-1.c GCC/gcc/testsuite/gcc.dg/postincr-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/postincr-1.c	2002-12-18 20:00:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/postincr-1.c	2004-08-01 21:31:23.000000000 +0000
@@ -1,6 +1,8 @@
 /* Simple test for proper postincrement semantics.  */
 /* { dg-do run } */
 
+extern void abort (void);
+
 int i;
 int c;
 int *f ()
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/pr10392-1.c GCC/gcc/testsuite/gcc.dg/pr10392-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/pr10392-1.c	2004-01-16 18:24:09.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/pr10392-1.c	2004-08-01 21:31:40.000000000 +0000
@@ -13,6 +13,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2" } */
 /* { dg-options "-O2 -m4" { target sh4-*-* } } */
+extern void abort (void);
 const char *dont_optimize_function_away;
 
 const char *use(const char *str)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/pragma-align.c GCC/gcc/testsuite/gcc.dg/pragma-align.c
--- GCC.orig/gcc/testsuite/gcc.dg/pragma-align.c	2004-07-25 18:35:38.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/pragma-align.c	2004-08-01 21:31:57.000000000 +0000
@@ -2,6 +2,8 @@
 
 /* { dg-do run { target i?86-*-linux* i?86-*-*bsd* i?86-*-sco3.2v5* *-*-solaris2.* } } */
 
+extern void abort (void);
+
 struct {
         char one;
         long two;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/profile-generate-1.c GCC/gcc/testsuite/gcc.dg/profile-generate-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/profile-generate-1.c	2004-07-15 00:35:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/profile-generate-1.c	2004-08-01 21:32:07.000000000 +0000
@@ -1,6 +1,8 @@
 /* Bug 16325.  */
 /* { dg-options "-O -fprofile-generate" } */
 
+extern void abort (void);
+
 int *p1;
 int *p2;
 int *p3;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/redecl-3.c GCC/gcc/testsuite/gcc.dg/redecl-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/redecl-3.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/redecl-3.c	2004-07-31 00:06:26.000000000 +0000
@@ -0,0 +1,1180 @@
+/* Test for multiple declarations and composite types.  Includes bug
+   13801.  */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+typedef int IA[];
+typedef int A10[10];
+
+/* Test all combinations of: a variable declared at file scope (no
+   type specifiers, or extern, or static), or just inside a function
+   (with extern), redeclared in an inner scope (with extern), and
+   redeclared in an inner scope when the previous declaration is
+   hidden (with extern, and not if the original declaration was
+   static).  Test three times: incomplete variable types; pointers to
+   incomplete types; functions returning such pointers.  */
+
+IA a0;
+void
+f0 (void)
+{
+  sizeof(a0); /* { dg-error "incomplete" } */
+  {
+    extern IA a0;
+    sizeof(a0); /* { dg-error "incomplete" } */
+    {
+      int a0;
+      {
+        extern IA a0;
+        sizeof(a0); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(a0); /* { dg-error "incomplete" } */
+  }
+  sizeof(a0); /* { dg-error "incomplete" } */
+}
+extern A10 a0;
+
+IA a1;
+void
+f1 (void)
+{
+  sizeof(a1); /* { dg-error "incomplete" } */
+  {
+    extern IA a1;
+    sizeof(a1); /* { dg-error "incomplete" } */
+    {
+      int a1;
+      {
+        extern A10 a1;
+        sizeof(a1);
+      }
+    }
+    sizeof(a1); /* { dg-error "incomplete" } */
+  }
+  sizeof(a1); /* { dg-error "incomplete" } */
+}
+extern A10 a1;
+
+IA a2;
+void
+f2 (void)
+{
+  sizeof(a2); /* { dg-error "incomplete" } */
+  {
+    extern A10 a2;
+    sizeof(a2);
+    {
+      int a2;
+      {
+        extern IA a2;
+        sizeof(a2); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(a2);
+  }
+  sizeof(a2); /* { dg-error "incomplete" } */
+}
+extern A10 a2;
+
+IA a3;
+void
+f3 (void)
+{
+  sizeof(a3); /* { dg-error "incomplete" } */
+  {
+    extern A10 a3;
+    sizeof(a3);
+    {
+      int a3;
+      {
+        extern A10 a3;
+        sizeof(a3);
+      }
+    }
+    sizeof(a3);
+  }
+  sizeof(a3); /* { dg-error "incomplete" } */
+}
+extern A10 a3;
+
+A10 a4;
+void
+f4 (void)
+{
+  sizeof(a4);
+  {
+    extern IA a4;
+    sizeof(a4);
+    {
+      int a4;
+      {
+        extern IA a4;
+        sizeof(a4); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(a4);
+  }
+  sizeof(a4);
+}
+extern A10 a4;
+
+A10 a5;
+void
+f5 (void)
+{
+  sizeof(a5);
+  {
+    extern IA a5;
+    sizeof(a5);
+    {
+      int a5;
+      {
+        extern A10 a5;
+        sizeof(a5);
+      }
+    }
+    sizeof(a5);
+  }
+  sizeof(a5);
+}
+extern A10 a5;
+
+A10 a6;
+void
+f6 (void)
+{
+  sizeof(a6);
+  {
+    extern A10 a6;
+    sizeof(a6);
+    {
+      int a6;
+      {
+        extern IA a6;
+        sizeof(a6); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(a6);
+  }
+  sizeof(a6);
+}
+extern A10 a6;
+
+A10 a7;
+void
+f7 (void)
+{
+  sizeof(a7);
+  {
+    extern A10 a7;
+    sizeof(a7);
+    {
+      int a7;
+      {
+        extern A10 a7;
+        sizeof(a7);
+      }
+    }
+    sizeof(a7);
+  }
+  sizeof(a7);
+}
+extern A10 a7;
+
+extern IA a8;
+void
+f8 (void)
+{
+  sizeof(a8); /* { dg-error "incomplete" } */
+  {
+    extern IA a8;
+    sizeof(a8); /* { dg-error "incomplete" } */
+    {
+      int a8;
+      {
+        extern IA a8;
+        sizeof(a8); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(a8); /* { dg-error "incomplete" } */
+  }
+  sizeof(a8); /* { dg-error "incomplete" } */
+}
+extern A10 a8;
+
+extern IA a9;
+void
+f9 (void)
+{
+  sizeof(a9); /* { dg-error "incomplete" } */
+  {
+    extern IA a9;
+    sizeof(a9); /* { dg-error "incomplete" } */
+    {
+      int a9;
+      {
+        extern A10 a9;
+        sizeof(a9);
+      }
+    }
+    sizeof(a9); /* { dg-error "incomplete" } */
+  }
+  sizeof(a9); /* { dg-error "incomplete" } */
+}
+extern A10 a9;
+
+extern IA a10;
+void
+f10 (void)
+{
+  sizeof(a10); /* { dg-error "incomplete" } */
+  {
+    extern A10 a10;
+    sizeof(a10);
+    {
+      int a10;
+      {
+        extern IA a10;
+        sizeof(a10); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(a10);
+  }
+  sizeof(a10); /* { dg-error "incomplete" } */
+}
+extern A10 a10;
+
+extern IA a11;
+void
+f11 (void)
+{
+  sizeof(a11); /* { dg-error "incomplete" } */
+  {
+    extern A10 a11;
+    sizeof(a11);
+    {
+      int a11;
+      {
+        extern A10 a11;
+        sizeof(a11);
+      }
+    }
+    sizeof(a11);
+  }
+  sizeof(a11); /* { dg-error "incomplete" } */
+}
+extern A10 a11;
+
+extern A10 a12;
+void
+f12 (void)
+{
+  sizeof(a12);
+  {
+    extern IA a12;
+    sizeof(a12);
+    {
+      int a12;
+      {
+        extern IA a12;
+        sizeof(a12); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(a12);
+  }
+  sizeof(a12);
+}
+extern A10 a12;
+
+extern A10 a13;
+void
+f13 (void)
+{
+  sizeof(a13);
+  {
+    extern IA a13;
+    sizeof(a13);
+    {
+      int a13;
+      {
+        extern A10 a13;
+        sizeof(a13);
+      }
+    }
+    sizeof(a13);
+  }
+  sizeof(a13);
+}
+extern A10 a13;
+
+extern A10 a14;
+void
+f14 (void)
+{
+  sizeof(a14);
+  {
+    extern A10 a14;
+    sizeof(a14);
+    {
+      int a14;
+      {
+        extern IA a14;
+        sizeof(a14); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(a14);
+  }
+  sizeof(a14);
+}
+extern A10 a14;
+
+extern A10 a15;
+void
+f15 (void)
+{
+  sizeof(a15);
+  {
+    extern A10 a15;
+    sizeof(a15);
+    {
+      int a15;
+      {
+        extern A10 a15;
+        sizeof(a15);
+      }
+    }
+    sizeof(a15);
+  }
+  sizeof(a15);
+}
+extern A10 a15;
+
+static IA a16;
+void
+f16 (void)
+{
+  sizeof(a16); /* { dg-error "incomplete" } */
+  {
+    extern IA a16;
+    sizeof(a16); /* { dg-error "incomplete" } */
+  }
+  sizeof(a16); /* { dg-error "incomplete" } */
+}
+extern A10 a16;
+
+static IA a17;
+void
+f17 (void)
+{
+  sizeof(a17); /* { dg-error "incomplete" } */
+  {
+    extern A10 a17;
+    sizeof(a17);
+  }
+  sizeof(a17); /* { dg-error "incomplete" } */
+}
+extern A10 a17;
+
+static A10 a18;
+void
+f18 (void)
+{
+  sizeof(a18);
+  {
+    extern IA a18;
+    sizeof(a18);
+  }
+  sizeof(a18);
+}
+extern A10 a18;
+
+static A10 a19;
+void
+f19 (void)
+{
+  sizeof(a19);
+  {
+    extern A10 a19;
+    sizeof(a19);
+  }
+  sizeof(a19);
+}
+extern A10 a19;
+
+IA *b0;
+void
+g0 (void)
+{
+  sizeof(*b0); /* { dg-error "incomplete" } */
+  {
+    extern IA *b0;
+    sizeof(*b0); /* { dg-error "incomplete" } */
+    {
+      int b0;
+      {
+        extern IA *b0;
+        sizeof(*b0); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*b0); /* { dg-error "incomplete" } */
+  }
+  sizeof(*b0); /* { dg-error "incomplete" } */
+}
+extern A10 *b0;
+
+IA *b1;
+void
+g1 (void)
+{
+  sizeof(*b1); /* { dg-error "incomplete" } */
+  {
+    extern IA *b1;
+    sizeof(*b1); /* { dg-error "incomplete" } */
+    {
+      int b1;
+      {
+        extern A10 *b1;
+        sizeof(*b1);
+      }
+    }
+    sizeof(*b1); /* { dg-error "incomplete" } */
+  }
+  sizeof(*b1); /* { dg-error "incomplete" } */
+}
+extern A10 *b1;
+
+IA *b2;
+void
+g2 (void)
+{
+  sizeof(*b2); /* { dg-error "incomplete" } */
+  {
+    extern A10 *b2;
+    sizeof(*b2);
+    {
+      int b2;
+      {
+        extern IA *b2;
+        sizeof(*b2); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*b2);
+  }
+  sizeof(*b2); /* { dg-error "incomplete" } */
+}
+extern A10 *b2;
+
+IA *b3;
+void
+g3 (void)
+{
+  sizeof(*b3); /* { dg-error "incomplete" } */
+  {
+    extern A10 *b3;
+    sizeof(*b3);
+    {
+      int b3;
+      {
+        extern A10 *b3;
+        sizeof(*b3);
+      }
+    }
+    sizeof(*b3);
+  }
+  sizeof(*b3); /* { dg-error "incomplete" } */
+}
+extern A10 *b3;
+
+A10 *b4;
+void
+g4 (void)
+{
+  sizeof(*b4);
+  {
+    extern IA *b4;
+    sizeof(*b4);
+    {
+      int b4;
+      {
+        extern IA *b4;
+        sizeof(*b4); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*b4);
+  }
+  sizeof(*b4);
+}
+extern A10 *b4;
+
+A10 *b5;
+void
+g5 (void)
+{
+  sizeof(*b5);
+  {
+    extern IA *b5;
+    sizeof(*b5);
+    {
+      int b5;
+      {
+        extern A10 *b5;
+        sizeof(*b5);
+      }
+    }
+    sizeof(*b5);
+  }
+  sizeof(*b5);
+}
+extern A10 *b5;
+
+A10 *b6;
+void
+g6 (void)
+{
+  sizeof(*b6);
+  {
+    extern A10 *b6;
+    sizeof(*b6);
+    {
+      int b6;
+      {
+        extern IA *b6;
+        sizeof(*b6); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*b6);
+  }
+  sizeof(*b6);
+}
+extern A10 *b6;
+
+A10 *b7;
+void
+g7 (void)
+{
+  sizeof(*b7);
+  {
+    extern A10 *b7;
+    sizeof(*b7);
+    {
+      int b7;
+      {
+        extern A10 *b7;
+        sizeof(*b7);
+      }
+    }
+    sizeof(*b7);
+  }
+  sizeof(*b7);
+}
+extern A10 *b7;
+
+extern IA *b8;
+void
+g8 (void)
+{
+  sizeof(*b8); /* { dg-error "incomplete" } */
+  {
+    extern IA *b8;
+    sizeof(*b8); /* { dg-error "incomplete" } */
+    {
+      int b8;
+      {
+        extern IA *b8;
+        sizeof(*b8); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*b8); /* { dg-error "incomplete" } */
+  }
+  sizeof(*b8); /* { dg-error "incomplete" } */
+}
+extern A10 *b8;
+
+extern IA *b9;
+void
+g9 (void)
+{
+  sizeof(*b9); /* { dg-error "incomplete" } */
+  {
+    extern IA *b9;
+    sizeof(*b9); /* { dg-error "incomplete" } */
+    {
+      int b9;
+      {
+        extern A10 *b9;
+        sizeof(*b9);
+      }
+    }
+    sizeof(*b9); /* { dg-error "incomplete" } */
+  }
+  sizeof(*b9); /* { dg-error "incomplete" } */
+}
+extern A10 *b9;
+
+extern IA *b10;
+void
+g10 (void)
+{
+  sizeof(*b10); /* { dg-error "incomplete" } */
+  {
+    extern A10 *b10;
+    sizeof(*b10);
+    {
+      int b10;
+      {
+        extern IA *b10;
+        sizeof(*b10); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*b10);
+  }
+  sizeof(*b10); /* { dg-error "incomplete" } */
+}
+extern A10 *b10;
+
+extern IA *b11;
+void
+g11 (void)
+{
+  sizeof(*b11); /* { dg-error "incomplete" } */
+  {
+    extern A10 *b11;
+    sizeof(*b11);
+    {
+      int b11;
+      {
+        extern A10 *b11;
+        sizeof(*b11);
+      }
+    }
+    sizeof(*b11);
+  }
+  sizeof(*b11); /* { dg-error "incomplete" } */
+}
+extern A10 *b11;
+
+extern A10 *b12;
+void
+g12 (void)
+{
+  sizeof(*b12);
+  {
+    extern IA *b12;
+    sizeof(*b12);
+    {
+      int b12;
+      {
+        extern IA *b12;
+        sizeof(*b12); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*b12);
+  }
+  sizeof(*b12);
+}
+extern A10 *b12;
+
+extern A10 *b13;
+void
+g13 (void)
+{
+  sizeof(*b13);
+  {
+    extern IA *b13;
+    sizeof(*b13);
+    {
+      int b13;
+      {
+        extern A10 *b13;
+        sizeof(*b13);
+      }
+    }
+    sizeof(*b13);
+  }
+  sizeof(*b13);
+}
+extern A10 *b13;
+
+extern A10 *b14;
+void
+g14 (void)
+{
+  sizeof(*b14);
+  {
+    extern A10 *b14;
+    sizeof(*b14);
+    {
+      int b14;
+      {
+        extern IA *b14;
+        sizeof(*b14); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*b14);
+  }
+  sizeof(*b14);
+}
+extern A10 *b14;
+
+extern A10 *b15;
+void
+g15 (void)
+{
+  sizeof(*b15);
+  {
+    extern A10 *b15;
+    sizeof(*b15);
+    {
+      int b15;
+      {
+        extern A10 *b15;
+        sizeof(*b15);
+      }
+    }
+    sizeof(*b15);
+  }
+  sizeof(*b15);
+}
+extern A10 *b15;
+
+static IA *b16;
+void
+g16 (void)
+{
+  sizeof(*b16); /* { dg-error "incomplete" } */
+  {
+    extern IA *b16;
+    sizeof(*b16); /* { dg-error "incomplete" } */
+  }
+  sizeof(*b16); /* { dg-error "incomplete" } */
+}
+extern A10 *b16;
+
+static IA *b17;
+void
+g17 (void)
+{
+  sizeof(*b17); /* { dg-error "incomplete" } */
+  {
+    extern A10 *b17;
+    sizeof(*b17);
+  }
+  sizeof(*b17); /* { dg-error "incomplete" } */
+}
+extern A10 *b17;
+
+static A10 *b18;
+void
+g18 (void)
+{
+  sizeof(*b18);
+  {
+    extern IA *b18;
+    sizeof(*b18);
+  }
+  sizeof(*b18);
+}
+extern A10 *b18;
+
+static A10 *b19;
+void
+g19 (void)
+{
+  sizeof(*b19);
+  {
+    extern A10 *b19;
+    sizeof(*b19);
+  }
+  sizeof(*b19);
+}
+extern A10 *b19;
+
+IA *c0 (void);
+void
+h0 (void)
+{
+  sizeof(*c0()); /* { dg-error "incomplete" } */
+  {
+    extern IA *c0 (void);
+    sizeof(*c0()); /* { dg-error "incomplete" } */
+    {
+      int c0;
+      {
+        extern IA *c0 (void);
+        sizeof(*c0()); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*c0()); /* { dg-error "incomplete" } */
+  }
+  sizeof(*c0()); /* { dg-error "incomplete" } */
+}
+A10 *c0 (void) { return 0; }
+
+IA *c1 (void);
+void
+h1 (void)
+{
+  sizeof(*c1()); /* { dg-error "incomplete" } */
+  {
+    extern IA *c1 (void);
+    sizeof(*c1()); /* { dg-error "incomplete" } */
+    {
+      int c1;
+      {
+        extern A10 *c1 (void);
+        sizeof(*c1());
+      }
+    }
+    sizeof(*c1()); /* { dg-error "incomplete" } */
+  }
+  sizeof(*c1()); /* { dg-error "incomplete" } */
+}
+A10 *c1 (void) { return 0; }
+
+IA *c2 (void);
+void
+h2 (void)
+{
+  sizeof(*c2()); /* { dg-error "incomplete" } */
+  {
+    extern A10 *c2 (void);
+    sizeof(*c2());
+    {
+      int c2;
+      {
+        extern IA *c2 (void);
+        sizeof(*c2()); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*c2());
+  }
+  sizeof(*c2()); /* { dg-error "incomplete" } */
+}
+A10 *c2 (void) { return 0; }
+
+IA *c3 (void);
+void
+h3 (void)
+{
+  sizeof(*c3()); /* { dg-error "incomplete" } */
+  {
+    extern A10 *c3 (void);
+    sizeof(*c3());
+    {
+      int c3;
+      {
+        extern A10 *c3 (void);
+        sizeof(*c3());
+      }
+    }
+    sizeof(*c3());
+  }
+  sizeof(*c3()); /* { dg-error "incomplete" } */
+}
+A10 *c3 (void) { return 0; }
+
+A10 *c4 (void);
+void
+h4 (void)
+{
+  sizeof(*c4());
+  {
+    extern IA *c4 (void);
+    sizeof(*c4());
+    {
+      int c4;
+      {
+        extern IA *c4 (void);
+        sizeof(*c4()); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*c4());
+  }
+  sizeof(*c4());
+}
+A10 *c4 (void) { return 0; }
+
+A10 *c5 (void);
+void
+h5 (void)
+{
+  sizeof(*c5());
+  {
+    extern IA *c5 (void);
+    sizeof(*c5());
+    {
+      int c5;
+      {
+        extern A10 *c5 (void);
+        sizeof(*c5());
+      }
+    }
+    sizeof(*c5());
+  }
+  sizeof(*c5());
+}
+A10 *c5 (void) { return 0; }
+
+A10 *c6 (void);
+void
+h6 (void)
+{
+  sizeof(*c6());
+  {
+    extern A10 *c6 (void);
+    sizeof(*c6());
+    {
+      int c6;
+      {
+        extern IA *c6 (void);
+        sizeof(*c6()); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*c6());
+  }
+  sizeof(*c6());
+}
+A10 *c6 (void) { return 0; }
+
+A10 *c7 (void);
+void
+h7 (void)
+{
+  sizeof(*c7());
+  {
+    extern A10 *c7 (void);
+    sizeof(*c7());
+    {
+      int c7;
+      {
+        extern A10 *c7 (void);
+        sizeof(*c7());
+      }
+    }
+    sizeof(*c7());
+  }
+  sizeof(*c7());
+}
+A10 *c7 (void) { return 0; }
+
+extern IA *c8 (void);
+void
+h8 (void)
+{
+  sizeof(*c8()); /* { dg-error "incomplete" } */
+  {
+    extern IA *c8 (void);
+    sizeof(*c8()); /* { dg-error "incomplete" } */
+    {
+      int c8;
+      {
+        extern IA *c8 (void);
+        sizeof(*c8()); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*c8()); /* { dg-error "incomplete" } */
+  }
+  sizeof(*c8()); /* { dg-error "incomplete" } */
+}
+extern A10 *c8 (void) { return 0; }
+
+extern IA *c9 (void);
+void
+h9 (void)
+{
+  sizeof(*c9()); /* { dg-error "incomplete" } */
+  {
+    extern IA *c9 (void);
+    sizeof(*c9()); /* { dg-error "incomplete" } */
+    {
+      int c9;
+      {
+        extern A10 *c9 (void);
+        sizeof(*c9());
+      }
+    }
+    sizeof(*c9()); /* { dg-error "incomplete" } */
+  }
+  sizeof(*c9()); /* { dg-error "incomplete" } */
+}
+extern A10 *c9 (void) { return 0; }
+
+extern IA *c10 (void);
+void
+h10 (void)
+{
+  sizeof(*c10()); /* { dg-error "incomplete" } */
+  {
+    extern A10 *c10 (void);
+    sizeof(*c10());
+    {
+      int c10;
+      {
+        extern IA *c10 (void);
+        sizeof(*c10()); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*c10());
+  }
+  sizeof(*c10()); /* { dg-error "incomplete" } */
+}
+extern A10 *c10 (void) { return 0; }
+
+extern IA *c11 (void);
+void
+h11 (void)
+{
+  sizeof(*c11()); /* { dg-error "incomplete" } */
+  {
+    extern A10 *c11 (void);
+    sizeof(*c11());
+    {
+      int c11;
+      {
+        extern A10 *c11 (void);
+        sizeof(*c11());
+      }
+    }
+    sizeof(*c11());
+  }
+  sizeof(*c11()); /* { dg-error "incomplete" } */
+}
+extern A10 *c11 (void) { return 0; }
+
+extern A10 *c12 (void);
+void
+h12 (void)
+{
+  sizeof(*c12());
+  {
+    extern IA *c12 (void);
+    sizeof(*c12());
+    {
+      int c12;
+      {
+        extern IA *c12 (void);
+        sizeof(*c12()); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*c12());
+  }
+  sizeof(*c12());
+}
+extern A10 *c12 (void) { return 0; }
+
+extern A10 *c13 (void);
+void
+h13 (void)
+{
+  sizeof(*c13());
+  {
+    extern IA *c13 (void);
+    sizeof(*c13());
+    {
+      int c13;
+      {
+        extern A10 *c13 (void);
+        sizeof(*c13());
+      }
+    }
+    sizeof(*c13());
+  }
+  sizeof(*c13());
+}
+extern A10 *c13 (void) { return 0; }
+
+extern A10 *c14 (void);
+void
+h14 (void)
+{
+  sizeof(*c14());
+  {
+    extern A10 *c14 (void);
+    sizeof(*c14());
+    {
+      int c14;
+      {
+        extern IA *c14 (void);
+        sizeof(*c14()); /* { dg-error "incomplete" } */
+      }
+    }
+    sizeof(*c14());
+  }
+  sizeof(*c14());
+}
+extern A10 *c14 (void) { return 0; }
+
+extern A10 *c15 (void);
+void
+h15 (void)
+{
+  sizeof(*c15());
+  {
+    extern A10 *c15 (void);
+    sizeof(*c15());
+    {
+      int c15;
+      {
+        extern A10 *c15 (void);
+        sizeof(*c15());
+      }
+    }
+    sizeof(*c15());
+  }
+  sizeof(*c15());
+}
+extern A10 *c15 (void) { return 0; }
+
+static IA *c16 (void);
+void
+h16 (void)
+{
+  sizeof(*c16()); /* { dg-error "incomplete" } */
+  {
+    extern IA *c16 (void);
+    sizeof(*c16()); /* { dg-error "incomplete" } */
+  }
+  sizeof(*c16()); /* { dg-error "incomplete" } */
+}
+static A10 *c16 (void) { return 0; }
+
+static IA *c17 (void);
+void
+h17 (void)
+{
+  sizeof(*c17()); /* { dg-error "incomplete" } */
+  {
+    extern A10 *c17 (void);
+    sizeof(*c17());
+  }
+  sizeof(*c17()); /* { dg-error "incomplete" } */
+}
+static A10 *c17 (void) { return 0; }
+
+static A10 *c18 (void);
+void
+h18 (void)
+{
+  sizeof(*c18());
+  {
+    extern IA *c18 (void);
+    sizeof(*c18());
+  }
+  sizeof(*c18());
+}
+static A10 *c18 (void) { return 0; }
+
+static A10 *c19 (void);
+void
+h19 (void)
+{
+  sizeof(*c19());
+  {
+    extern A10 *c19 (void);
+    sizeof(*c19());
+  }
+  sizeof(*c19());
+}
+static A10 *c19 (void) { return 0; }
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/redecl-4.c GCC/gcc/testsuite/gcc.dg/redecl-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/redecl-4.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/redecl-4.c	2004-08-01 17:16:25.000000000 +0000
@@ -0,0 +1,28 @@
+/* Test for multiple declarations and composite types, with built-in
+   functions.  */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-std=c89 -Wformat" } */
+
+void
+f (void)
+{
+  int printf;
+  int strcmp;
+  {
+    int printf (const char *, ...);
+    int strcmp ();
+    /* Should get format warnings even though the built-in declaration
+       isn't "visible".  */
+    printf ("%s", 1); /* { dg-warning "format" } */
+    /* The type of strcmp here should have no prototype.  */
+    if (0)
+      strcmp (1);
+    /* Likewise, implicitly declared memcmp.  */
+    if (0)
+      memcmp (1);
+  }
+}
+
+/* Should still diagnose incompatible prototype for strcmp.  */
+int strcmp (void); /* { dg-error "conflict" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/redecl-5.c GCC/gcc/testsuite/gcc.dg/redecl-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/redecl-5.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/redecl-5.c	2004-08-01 20:36:26.000000000 +0000
@@ -0,0 +1,19 @@
+/* Test for multiple declarations and composite types.  Diagnosis of
+   incompatible implicit declaration.  */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-std=c89" } */
+
+void
+f (void)
+{
+  long z(); /* { dg-error "previous implicit declaration" } */
+}
+
+void
+g (void)
+{
+  z(); /* { dg-error "incompatible" } */
+  labs(1); /* { dg-warning "incompatible" } */
+  printf("x"); /* { dg-warning "incompatible" } */
+}
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/sibcall-1.c GCC/gcc/testsuite/gcc.dg/sibcall-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/sibcall-1.c	2002-09-29 18:16:15.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/sibcall-1.c	2004-08-02 17:12:37.000000000 +0000
@@ -11,6 +11,9 @@
    marker.  Self-recursion tail calls are optimized for all targets,
    regardless of presence of sibcall patterns.  */
 
+extern void abort (void);
+extern void exit (int);
+
 extern void recurser_void (int);
 extern void track (int);
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/sibcall-2.c GCC/gcc/testsuite/gcc.dg/sibcall-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/sibcall-2.c	2002-09-29 18:16:15.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/sibcall-2.c	2004-08-02 17:12:44.000000000 +0000
@@ -11,6 +11,9 @@
    marker.  Self-recursion tail calls are optimized for all targets,
    regardless of presence of sibcall patterns.  */
 
+extern void abort (void);
+extern void exit (int);
+
 extern void recurser_void (void);
 extern void track (void);
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/sibcall-3.c GCC/gcc/testsuite/gcc.dg/sibcall-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/sibcall-3.c	2004-05-11 19:57:32.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/sibcall-3.c	2004-08-02 17:12:53.000000000 +0000
@@ -13,6 +13,9 @@
    (except targets where the test does not work due to the return address
    not saved on the regular stack).  */
 
+extern void abort (void);
+extern void exit (int);
+
 static void recurser_void1 (int);
 static void recurser_void2 (int);
 extern void track (int);
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/sibcall-4.c GCC/gcc/testsuite/gcc.dg/sibcall-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/sibcall-4.c	2004-05-11 19:57:32.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/sibcall-4.c	2004-08-02 17:13:02.000000000 +0000
@@ -13,6 +13,9 @@
    (except targets where the test does not work due to the return address
    not saved on the regular stack).  */
 
+extern void abort (void);
+extern void exit (int);
+
 static void recurser_void1 (void);
 static void recurser_void2 (void);
 extern void track (void);
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/sibcall-5.c GCC/gcc/testsuite/gcc.dg/sibcall-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/sibcall-5.c	2002-12-16 18:22:43.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/sibcall-5.c	2004-08-01 21:33:03.000000000 +0000
@@ -2,6 +2,8 @@
 /* { dg-do run { target i?86-*-* } } */
 /* { dg-options "-O2" } */
 
+extern void abort (void);
+
 int (*f)(int, int) __attribute__((regparm(2)));
 int (*g)(int, int, int) __attribute__((regparm(3)));
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/sibcall-6.c GCC/gcc/testsuite/gcc.dg/sibcall-6.c
--- GCC.orig/gcc/testsuite/gcc.dg/sibcall-6.c	2004-04-30 20:26:43.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/sibcall-6.c	2004-08-02 17:13:19.000000000 +0000
@@ -9,6 +9,9 @@
 /* { dg-do run { target i?86-*-* s390*-*-* x86_64-*-*} } */
 /* { dg-options "-O2 -foptimize-sibling-calls" } */
 
+extern void abort (void);
+extern void exit (int);
+
 int foo (int);
 int bar (int);
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/switch-warn-1.c GCC/gcc/testsuite/gcc.dg/switch-warn-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/switch-warn-1.c	2004-07-20 09:57:13.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/switch-warn-1.c	2004-08-02 17:11:59.000000000 +0000
@@ -1,6 +1,9 @@
 /* { dg-do run } */
 /* { dg-options "-O0" } */
 
+extern void abort (void);
+extern void exit (int);
+
 /* Check that out-of-bounds case warnings work in the case that the
    testing expression is promoted.  */
 int
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/switch-warn-2.c GCC/gcc/testsuite/gcc.dg/switch-warn-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/switch-warn-2.c	2004-07-20 09:57:13.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/switch-warn-2.c	2004-08-01 21:33:32.000000000 +0000
@@ -2,6 +2,9 @@
 /* { dg-do run } */
 /* { dg-options "-O0" } */
 
+extern void abort (void);
+extern void exit (int);
+
 int
 foo (unsigned int i)
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/torture/builtin-attr-1.c GCC/gcc/testsuite/gcc.dg/torture/builtin-attr-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/torture/builtin-attr-1.c	2003-09-09 03:29:18.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/torture/builtin-attr-1.c	2004-08-02 20:50:37.000000000 +0000
@@ -26,9 +26,10 @@ void test_builtin_##FN(TYPE x, TYPE y) \
 { if (__builtin_##FN(x,y) != __builtin_##FN(x,y)) link_failure_builtin_##FN(); }
 
 /* Also test the regular (non-__builtin_) function.  */
-#define TEST1(FN, TYPE) \
+#define TEST1(FN, TYPE, RTYPE) \
 BUILTIN_TEST1(FN, TYPE) \
 extern void link_failure_##FN(void); \
+extern RTYPE FN(TYPE); \
 void test_##FN(TYPE x) { if (FN(x) != FN(x)) link_failure_##FN(); }
 
 /* Test the __builtin_ functions taking void arguments (with the "f"
@@ -153,12 +154,32 @@ void test_builtin_##FN##l(_Complex long 
 /* These macros additionally test the non-__builtin_ functions.  */
 
 /* Test the functions taking one FP argument (with the "f" and "l"
-   variants).  */
+   variants) and returning that type.  */
 #define FPTEST1(FN) \
 BUILTIN_FPTEST1(FN) \
 extern void link_failure_##FN(void); \
 extern void link_failure_##FN##f(void); \
 extern void link_failure_##FN##l(void); \
+extern double FN(double); \
+extern float FN##f(float); \
+extern long double FN##l(long double); \
+void test_##FN(double d) \
+{ if (FN(d) != FN(d)) link_failure_##FN(); } \
+void test_##FN##f(float f) \
+{ if (FN##f(f) != FN##f(f)) link_failure_##FN##f(); } \
+void test_##FN##l(long double ld) \
+{ if (FN##l(ld) != FN##l(ld)) link_failure_##FN##l(); }
+
+/* Test the functions taking one FP argument (with the "f" and "l"
+   variants) and returning TYPE.  */
+#define FPTEST1T(FN, TYPE) \
+BUILTIN_FPTEST1(FN) \
+extern void link_failure_##FN(void); \
+extern void link_failure_##FN##f(void); \
+extern void link_failure_##FN##l(void); \
+extern TYPE FN(double); \
+extern TYPE FN##f(float); \
+extern TYPE FN##l(long double); \
 void test_##FN(double d) \
 { if (FN(d) != FN(d)) link_failure_##FN(); } \
 void test_##FN##f(float f) \
@@ -173,6 +194,9 @@ BUILTIN_FPTEST2(FN) \
 extern void link_failure_##FN(void); \
 extern void link_failure_##FN##f(void); \
 extern void link_failure_##FN##l(void); \
+extern double FN(double, double); \
+extern float FN##f(float, float); \
+extern long double FN##l(long double, long double); \
 void test_##FN(double d1, double d2) \
 { if (FN(d1,d2) != FN(d1,d2)) link_failure_##FN(); } \
 void test_##FN##f(float f1, float f2) \
@@ -188,6 +212,9 @@ BUILTIN_FPTEST2ARG1(FN, TYPE) \
 extern void link_failure_##FN(void); \
 extern void link_failure_##FN##f(void); \
 extern void link_failure_##FN##l(void); \
+extern double FN(TYPE, double); \
+extern float FN##f(TYPE, float); \
+extern long double FN##l(TYPE, long double); \
 void test_##FN(TYPE x, double d) \
 { if (FN(x,d) != FN(x,d)) link_failure_##FN(); } \
 void test_##FN##f(TYPE x, float f) \
@@ -203,6 +230,9 @@ BUILTIN_FPTEST2ARG2(FN, TYPE) \
 extern void link_failure_##FN(void); \
 extern void link_failure_##FN##f(void); \
 extern void link_failure_##FN##l(void); \
+extern double FN(double, TYPE); \
+extern float FN##f(float, TYPE); \
+extern long double FN##l(long double, TYPE); \
 void test_##FN(double d, TYPE x) \
 { if (FN(d,x) != FN(d,x)) link_failure_##FN(); } \
 void test_##FN##f(float f, TYPE x) \
@@ -217,6 +247,9 @@ BUILTIN_FPTEST3(FN) \
 extern void link_failure_##FN(void); \
 extern void link_failure_##FN##f(void); \
 extern void link_failure_##FN##l(void); \
+extern double FN(double, double, double); \
+extern float FN##f(float, float, float); \
+extern long double FN##l(long double, long double, long double); \
 void test_##FN(double d1, double d2, double d3) \
 { if (FN(d1,d2,d3) != FN(d1,d2,d3)) link_failure_##FN(); } \
 void test_##FN##f(float f1, float f2, float f3) \
@@ -225,12 +258,32 @@ void test_##FN##l(long double ld1, long 
 { if (FN##l(ld1,ld2,ld3) != FN##l(ld1,ld2,ld3)) link_failure_##FN##l(); }
 
 /* Test the functions taking one complex argument (with the "f" and
-   "l" variants).  */
+   "l" variants) and returning that type.  */
 #define CPTEST1(FN) \
 BUILTIN_CPTEST1(FN) \
 extern void link_failure_##FN(void); \
 extern void link_failure_##FN##f(void); \
 extern void link_failure_##FN##l(void); \
+extern _Complex double FN(_Complex double); \
+extern _Complex float FN##f(_Complex float); \
+extern _Complex long double FN##l(_Complex long double); \
+void test_##FN(_Complex double d) \
+{ if (FN(d) != FN(d)) link_failure_##FN(); } \
+void test_##FN##f(_Complex float f) \
+{ if (FN##f(f) != FN##f(f)) link_failure_##FN##f(); } \
+void test_##FN##l(_Complex long double ld) \
+{ if (FN##l(ld) != FN##l(ld)) link_failure_##FN##l(); }
+
+/* Test the functions taking one complex argument (with the "f" and
+   "l" variants) and returning the real type.  */
+#define CPTEST1R(FN) \
+BUILTIN_CPTEST1(FN) \
+extern void link_failure_##FN(void); \
+extern void link_failure_##FN##f(void); \
+extern void link_failure_##FN##l(void); \
+extern double FN(_Complex double); \
+extern float FN##f(_Complex float); \
+extern long double FN##l(_Complex long double); \
 void test_##FN(_Complex double d) \
 { if (FN(d) != FN(d)) link_failure_##FN(); } \
 void test_##FN##f(_Complex float f) \
@@ -245,6 +298,9 @@ BUILTIN_CPTEST2(FN) \
 extern void link_failure_##FN(void); \
 extern void link_failure_##FN##f(void); \
 extern void link_failure_##FN##l(void); \
+extern _Complex double FN(_Complex double, _Complex double); \
+extern _Complex float FN##f(_Complex float, _Complex float); \
+extern _Complex long double FN##l(_Complex long double, _Complex long double); \
 void test_##FN(_Complex double d1, _Complex double d2) \
 { if (FN(d1,d2) != FN(d1,d2)) link_failure_##FN(); } \
 void test_##FN##f(_Complex float f1, _Complex float f2) \
@@ -283,27 +339,27 @@ FPTEST2            (fmod)
 FPTEST1            (gamma)
 BUILTIN_FPTEST0    (huge_val)
 FPTEST2            (hypot)
-FPTEST1            (ilogb)
+FPTEST1T           (ilogb, int)
 BUILTIN_FPTEST0    (inf)
 FPTEST1            (j0)
 FPTEST1            (j1)
 FPTEST2ARG1        (jn, int)
 FPTEST2ARG2        (ldexp, int)
 FPTEST1            (lgamma)
-FPTEST1            (llrint)
-FPTEST1            (llround)
+FPTEST1T           (llrint, long long)
+FPTEST1T           (llround, long long)
 FPTEST1            (log)
 FPTEST1            (log10)
 FPTEST1            (log1p)
 FPTEST1            (log2)
 FPTEST1            (logb)
-FPTEST1            (lrint)
-FPTEST1            (lround)
+FPTEST1T           (lrint, long)
+FPTEST1T           (lround, long)
 BUILTIN_FPTEST1ARG (nan, char *)
 BUILTIN_FPTEST1ARG (nans, char *)
 FPTEST1            (nearbyint)
 FPTEST2            (nextafter)
-FPTEST2            (nexttoward)
+FPTEST2ARG2        (nexttoward, long double)
 FPTEST2            (pow)
 FPTEST1            (pow10)
 FPTEST2            (remainder)
@@ -328,7 +384,7 @@ FPTEST2ARG1        (yn, int)
 /*CPTEST1 (cabs) See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00040.html */
 CPTEST1 (cacos)
 CPTEST1 (cacosh)
-CPTEST1 (carg)
+CPTEST1R (carg)
 CPTEST1 (casin)
 CPTEST1 (casinh)
 CPTEST1 (catan)
@@ -336,32 +392,43 @@ CPTEST1 (catanh)
 CPTEST1 (ccos)
 CPTEST1 (ccosh)
 CPTEST1 (cexp)
-CPTEST1 (cimag)
+CPTEST1R (cimag)
 /*CPTEST1 (clog)*/
 CPTEST1 (conj)
 CPTEST2 (cpow)
 CPTEST1 (cproj)
-CPTEST1 (creal)
+CPTEST1R (creal)
 CPTEST1 (csin)
 CPTEST1 (csinh)
 CPTEST1 (csqrt)
 CPTEST1 (ctan)
 CPTEST1 (ctanh)
 
+/* These next definitions are kludges.  When GCC has a <stdint.h> it
+   should be used.
+*/
+#if __INT_MAX__ == __LONG_LONG_MAX__
+typedef int intmax_t;
+#elif __LONG_MAX__ == __LONG_LONG_MAX__
+typedef long intmax_t;
+#else
+typedef long long intmax_t;
+#endif
+
 /* Various other const builtins.  */
-TEST1         (abs, int)
+TEST1         (abs, int, int)
 BUILTIN_TEST1 (clz, int)
 BUILTIN_TEST1 (clzl, long)
 BUILTIN_TEST1 (clzll, long long)
 BUILTIN_TEST1 (ctz, int)
 BUILTIN_TEST1 (ctzl, long)
 BUILTIN_TEST1 (ctzll, long long)
-TEST1         (ffs, int)
-TEST1         (ffsl, long)
-TEST1         (ffsll, long long)
-TEST1         (imaxabs, int)
-TEST1         (labs, long)
-TEST1         (llabs, long long)
+TEST1         (ffs, int, int)
+TEST1         (ffsl, long, int)
+TEST1         (ffsll, long long, int)
+TEST1         (imaxabs, intmax_t, intmax_t)
+TEST1         (labs, long, long)
+TEST1         (llabs, long long, long long)
 BUILTIN_TEST1 (parity, int)
 BUILTIN_TEST1 (parityl, long)
 BUILTIN_TEST1 (parityll, long long)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/torture/builtin-math-1.c GCC/gcc/testsuite/gcc.dg/torture/builtin-math-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/torture/builtin-math-1.c	2004-03-26 10:32:16.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/torture/builtin-math-1.c	2004-08-02 17:19:56.000000000 +0000
@@ -7,6 +7,34 @@
 
 /* { dg-do link } */
 
+extern double atan (double);
+extern float atanf (float);
+extern long double atanl (long double);
+extern double cbrt (double);
+extern float cbrtf (float);
+extern long double cbrtl (long double);
+extern double cos (double);
+extern float cosf (float);
+extern long double cosl (long double);
+extern double exp (double);
+extern float expf (float);
+extern long double expl (long double);
+extern double log (double);
+extern float logf (float);
+extern long double logl (long double);
+extern double pow (double, double);
+extern float powf (float, float);
+extern long double powl (long double, long double);
+extern double sin (double);
+extern float sinf (float);
+extern long double sinl (long double);
+extern double sqrt (double);
+extern float sqrtf (float);
+extern long double sqrtl (long double);
+extern double tan (double);
+extern float tanf (float);
+extern long double tanl (long double);
+
 /* All references to link_error should go away at compile-time.  */
 extern void link_error(void);
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c GCC/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c	2003-06-03 17:00:23.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c	2004-08-01 21:02:18.000000000 +0000
@@ -15,6 +15,7 @@ int
 main (void)
 {
   volatile int i = 0;
+  extern void exit (int);
   if (i)
     tabort ();
   if (i)
@@ -60,6 +61,7 @@ t_exit (void)
 void
 _exit (int i)
 {
+  extern void abort (void);
   abort ();
 }
 
@@ -81,5 +83,6 @@ t_Exit (void)
 void
 _Exit (int i)
 {
+  extern void abort (void);
   abort ();
 }
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/trampoline-1.c GCC/gcc/testsuite/gcc.dg/trampoline-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/trampoline-1.c	2003-11-10 08:11:47.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/trampoline-1.c	2004-08-01 21:33:52.000000000 +0000
@@ -8,6 +8,7 @@
    trampoline couldn't be made executable.  */
 
 extern void abort(void);
+extern double fabs(double);
 
 void foo (void)
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030703-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030703-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030703-1.c	2004-05-13 06:40:50.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030703-1.c	2004-08-01 20:50:26.000000000 +0000
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
   
-
+extern void abort (void);
 extern int blah[];
 
 foo(int index)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030703-2.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030703-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030703-2.c	2004-05-13 06:40:50.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030703-2.c	2004-08-01 20:50:46.000000000 +0000
@@ -1,6 +1,8 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
-                                                                                
+
+extern void abort (void);
+
 union tree_node;
 typedef union tree_node *tree;
 extern const char tree_code_type[];
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030708-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030708-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030708-1.c	2004-05-14 08:41:35.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030708-1.c	2004-08-01 20:51:01.000000000 +0000
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
+extern void abort (void);
 struct rtx_def;
 typedef struct rtx_def *rtx;
 enum rtx_code
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030709-3.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030709-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030709-3.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030709-3.c	2004-08-01 20:51:12.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
   
+extern void abort (void);
 
 union tree_node;
 typedef union tree_node *tree;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030710-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030710-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030710-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030710-1.c	2004-08-01 20:51:23.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
 
+extern void abort (void);
 union tree_node;
 typedef union tree_node *tree;
 struct tree_vec
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c	2004-08-01 20:51:33.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
  
+extern void abort (void);
 
 union tree_node;
 typedef union tree_node *tree;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c	2004-08-01 20:51:49.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
 
+extern void abort (void);
 union tree_node;
 typedef union tree_node *tree;
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c	2004-08-01 20:52:09.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-dom3" } */
      
+extern void exit (int);
 extern void *ggc_alloc (__SIZE_TYPE__);
 typedef struct dw_attr_struct *dw_attr_ref;
 typedef struct dw_attr_struct
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c	2004-08-01 20:52:20.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-dom3" } */
      
+extern void exit (int);
 extern void *ggc_alloc (__SIZE_TYPE__);
 typedef struct dw_attr_struct *dw_attr_ref;
 typedef struct dw_attr_struct
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030731-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030731-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030731-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030731-1.c	2004-08-01 20:52:29.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
   
+extern void abort (void);
 
 struct rtx_def;
 typedef struct rtx_def *rtx;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030807-11.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030807-11.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030807-11.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030807-11.c	2004-08-01 20:52:37.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
 
+extern void abort (void);
 struct rtx_def;
 typedef struct rtx_def *rtx;
 struct rtx_def
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030807-2.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030807-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030807-2.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030807-2.c	2004-08-01 20:52:52.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
      
+extern void abort (void);
 
 oof ()
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030807-5.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030807-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030807-5.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030807-5.c	2004-08-01 20:53:21.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
-                                                                                
+
+extern void abort (void);
 struct rtx_def;
 typedef struct rtx_def *rtx;
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c	2004-08-01 20:53:30.000000000 +0000
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-dom3" } */
   
- 
+extern void abort (void);
 
 union tree_node;
 typedef union tree_node *tree;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c	2004-05-14 08:41:35.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c	2004-08-01 20:53:42.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-cddce" } */
       
+extern void abort (void);
 
 struct rtx_def;
 typedef struct rtx_def *rtx;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-1.c	2004-08-01 20:53:50.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
    
+extern void abort (void);
 
 com(int *blah)
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-2.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-2.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-2.c	2004-08-01 20:53:57.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
     
+extern void abort (void);
 
 void
 foo (int value)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-3.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-3.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-3.c	2004-08-01 20:54:06.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
     
+extern void abort (void);
 
 void
 foo (int value)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-4.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-4.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-4.c	2004-08-01 20:54:15.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3 -fdump-tree-optimized" } */
     
+extern void abort (void);
 union tree_node;
 typedef union tree_node *tree;
 extern const char tree_code_type[];
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-5.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-5.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-5.c	2004-08-01 20:54:22.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3 -fdump-tree-optimized" } */
     
+extern void abort (void);
 union tree_node;
 typedef union tree_node *tree;
 extern const char tree_code_type[];
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-6.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-6.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-6.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-6.c	2004-08-01 20:54:31.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
 
+extern void abort (void);
 union tree_node;
 typedef union tree_node *tree;
 enum tree_code
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-7.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-7.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030814-7.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030814-7.c	2004-08-01 20:54:41.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
 
+extern void abort (void);
 struct rtx_def;
 typedef struct rtx_def *rtx;
 struct rtvec_def;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030815-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030815-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030815-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030815-1.c	2004-08-01 20:54:53.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
 
+extern void abort (void);
 typedef unsigned int size_t;
 struct rtx_def;
 typedef struct rtx_def *rtx;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030907-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030907-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030907-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030907-1.c	2004-08-01 20:55:07.000000000 +0000
@@ -6,6 +6,9 @@
 /* { dg-do compile } */
 /* { dg-options "-O -fdump-tree-optimized" } */
 
+extern void abort (void);
+extern void exit (int);
+
 int main() 
 { 
    int i; 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030917-3.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030917-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030917-3.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030917-3.c	2004-08-01 20:55:34.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fno-tree-dominator-opts -fdump-tree-ccp" } */
-                                                                                
+
+extern int printf (const char *, ...); 
 
 main ()
 {
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030922-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20030922-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20030922-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20030922-1.c	2004-08-01 20:55:44.000000000 +0000
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-dom3" } */
   
+extern void abort (void);
 
 union tree_node;
 typedef union tree_node *tree;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20031113-1.c	2004-08-01 20:56:26.000000000 +0000
@@ -7,6 +7,8 @@
 /* { dg-do compile } */
 /* { dg-options "-O1" } */ 
 
+extern __SIZE_TYPE__ strlen (const char *);
+
 int i; 
 
 static void 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040121-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20040121-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040121-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20040121-1.c	2004-08-01 20:56:36.000000000 +0000
@@ -4,6 +4,7 @@
     not boolean */
 /* { dg-options "-O3" } */
 /* { dg-do run } */
+extern void abort (void);
 char *foo(char *p, char *q) {
     int x = (p !=0) + (q != 0);
     if (x==2)  return "a"; else return 0;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c	2004-08-01 20:56:47.000000000 +0000
@@ -6,6 +6,8 @@
    were not being processed by the type based alias analyzer,
    resulting in optimizations removing a non-redundant load.  */
 
+extern void abort (void);
+
 struct bar { int count;  int *arr;};
 
 void foo (struct bar *b)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040324-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20040324-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040324-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20040324-1.c	2004-08-01 20:57:00.000000000 +0000
@@ -10,6 +10,9 @@
    Therefore, DOM did not see that i was modified between the two ifs
    and optimized away the second if.  */
 
+extern void abort (void);
+extern void exit (int);
+
 struct x
 {
   unsigned b:1;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040326-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20040326-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040326-1.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20040326-1.c	2004-08-02 17:15:47.000000000 +0000
@@ -4,6 +4,9 @@
    a .GLOBAL_VAR to model the side effects of functions.  Without it,
    we were moving the call to Faref() inside the second call to
    Faset().  */
+extern void abort (void);
+extern void exit (int);
+
 main ()
 {
   int table, c, elt;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040326-2.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20040326-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040326-2.c	2004-05-13 06:40:51.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20040326-2.c	2004-08-02 17:16:02.000000000 +0000
@@ -4,6 +4,7 @@
 /* Gimplification problem exposed by zsh.  All the side-effects in
    function arguments and in the called expression should happen
    before the actual function call.  */
+extern void abort (void);
 int A;
 
 typedef void (*fnptr) (void);
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c	2004-06-10 21:50:52.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c	2004-08-01 20:57:25.000000000 +0000
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O1 -fdump-tree-ssa-vops" } */
+extern void abort (void);
 int a; 
  
 extern void __attribute__ ((malloc)) *foo ();
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c GCC/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c	2004-05-13 06:40:52.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c	2004-08-01 20:57:46.000000000 +0000
@@ -5,6 +5,8 @@
    fail to terminate when there is a nontrivial cycle in the corresponding
    ssa graph.  */
 
+extern __SIZE_TYPE__ strlen (const char *);
+
 void foo(int i)
 {
   char *s = "abcde";
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-1.c	2004-06-12 08:54:47.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-1.c	2004-08-01 20:58:01.000000000 +0000
@@ -1,5 +1,6 @@
 /* { dg-do compile } */ 
 /* { dg-options "-O2 -fdump-tree-pre-stats" } */
+extern int printf (const char *, ...);
 int main(int argc, char **argv)
 {
 	int a;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/tailcall-1.c GCC/gcc/testsuite/gcc.dg/tree-ssa/tailcall-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/tailcall-1.c	2004-05-13 06:40:52.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/tailcall-1.c	2004-08-01 20:59:12.000000000 +0000
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-tailc-details" } */
+extern void *alloca (__SIZE_TYPE__);
 int q(int a);
 int *v;
 int
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-5.c GCC/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-5.c	2004-05-13 06:40:52.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-5.c	2004-08-01 20:59:37.000000000 +0000
@@ -1,6 +1,9 @@
 /* { dg-do run } */
 /* { dg-options "-O1 -fdump-tree-optimized" } */
 
+extern void abort (void);
+extern void exit (int);
+
 int sum (int n)
 {
   if (n == 0)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/ultrasp3.c GCC/gcc/testsuite/gcc.dg/ultrasp3.c
--- GCC.orig/gcc/testsuite/gcc.dg/ultrasp3.c	2000-11-25 17:38:58.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/ultrasp3.c	2004-08-01 21:34:13.000000000 +0000
@@ -1,6 +1,9 @@
 /* { dg-options "" } */
 /* { dg-options "-mcpu=ultrasparc -mv8plus" { target sparc-*-* } } */
 
+extern void abort (void);
+extern void exit (int);
+
 unsigned long long foo (unsigned long long x)
 {
   return 0x73500000735LL * x;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/winline-7.c GCC/gcc/testsuite/gcc.dg/winline-7.c
--- GCC.orig/gcc/testsuite/gcc.dg/winline-7.c	2004-01-07 19:33:12.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/winline-7.c	2004-08-01 21:35:03.000000000 +0000
@@ -1,6 +1,8 @@
 /* { dg-do compile } */
 /* { dg-options "-Winline -O2" } */
 
+extern void *alloca (__SIZE_TYPE__);
+
 void big (void);
 inline void *q (void)
 {				/* { dg-warning "(function not inlinable|alloca)" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/bprob-1.c GCC/gcc/testsuite/gcc.misc-tests/bprob-1.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/bprob-1.c	2002-02-07 16:53:56.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/bprob-1.c	2004-08-01 20:40:50.000000000 +0000
@@ -4,6 +4,8 @@
    This test is the same as gcov-4.c.  The "count" comments are left in to
    make comparisons easier; they are ignored for this test. */
 
+extern void abort (void);
+
 int do_something (int i)
 {
   return i;
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/bprob-2.c GCC/gcc/testsuite/gcc.misc-tests/bprob-2.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/bprob-2.c	2001-09-10 21:40:23.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/bprob-2.c	2004-08-01 20:41:31.000000000 +0000
@@ -3,6 +3,9 @@
    This is the same as test gcc.c-torture/execute/980526-1.c and
    gcc.misc-tests/gcov-3.c */
 
+extern void abort (void);
+extern void exit (int);
+
 int expect_do1 = 1, expect_do2 = 2;
  
 static int doit(int x){
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-3.c GCC/gcc/testsuite/gcc.misc-tests/gcov-3.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-3.c	2001-07-11 17:38:53.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/gcov-3.c	2004-08-01 20:41:49.000000000 +0000
@@ -4,6 +4,9 @@
 /* { dg-options "-fprofile-arcs -ftest-coverage" } */
 /* { dg-do run { target native } } */
 
+extern void abort (void);
+extern void exit (int);
+
 int expect_do1 = 1, expect_do2 = 2;
  
 static int doit(int x){
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-4.c GCC/gcc/testsuite/gcc.misc-tests/gcov-4.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-4.c	2002-02-07 16:53:56.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/gcov-4.c	2004-08-01 20:42:03.000000000 +0000
@@ -4,6 +4,8 @@
 /* { dg-options "-fprofile-arcs -ftest-coverage" } */
 /* { dg-do run { target native } } */
 
+extern void abort (void);
+
 int do_something (int i)
 {
   return i;
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-4b.c GCC/gcc/testsuite/gcc.misc-tests/gcov-4b.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-4b.c	2003-03-28 19:07:33.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/gcov-4b.c	2004-08-01 20:42:16.000000000 +0000
@@ -4,6 +4,8 @@
 /* { dg-options "-fprofile-arcs -ftest-coverage" } */
 /* { dg-do run { target native } } */
 
+extern void abort (void);
+
 int do_something (int i)
 {
   return i;
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-6.c GCC/gcc/testsuite/gcc.misc-tests/gcov-6.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-6.c	2003-03-28 19:07:33.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/gcov-6.c	2004-08-01 20:42:31.000000000 +0000
@@ -6,6 +6,8 @@
 /* { dg-options "-fprofile-arcs -ftest-coverage" } */
 /* { dg-do run { target native } } */
 
+extern void exit (int);
+
 int val;
 
 void
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-7.c GCC/gcc/testsuite/gcc.misc-tests/gcov-7.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/gcov-7.c	2003-03-28 19:07:33.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/gcov-7.c	2004-08-01 20:42:50.000000000 +0000
@@ -6,6 +6,9 @@
 
 #include <setjmp.h>
 
+extern void abort (void);
+extern void exit (int);
+
 jmp_buf env;
 int val;
 int longjmp_taken;
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/i386-pf-3dnow-1.c GCC/gcc/testsuite/gcc.misc-tests/i386-pf-3dnow-1.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/i386-pf-3dnow-1.c	2002-01-15 17:30:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/i386-pf-3dnow-1.c	2004-08-01 20:43:44.000000000 +0000
@@ -3,6 +3,8 @@
 
 /* { dg-do compile { target i?86-*-* } } */
 
+extern void exit (int);
+
 char *msg = "howdy there";
 
 void foo (char *p)
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c GCC/gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c	2002-01-15 17:30:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c	2004-08-01 20:43:49.000000000 +0000
@@ -4,6 +4,8 @@
 
 /* { dg-do compile { target i?86-*-* } } */
 
+extern void exit (int);
+
 char *msg = "howdy there";
 
 void foo (char *p)
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/i386-pf-none-1.c GCC/gcc/testsuite/gcc.misc-tests/i386-pf-none-1.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/i386-pf-none-1.c	2002-01-15 17:30:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/i386-pf-none-1.c	2004-08-01 20:43:16.000000000 +0000
@@ -3,6 +3,8 @@
 
 /* { dg-do compile { target i?86-*-* } } */
 
+extern void exit (int);
+
 char *msg = "howdy there";
 
 void foo (char *p)
diff -rupN GCC.orig/gcc/testsuite/gcc.misc-tests/i386-pf-sse-1.c GCC/gcc/testsuite/gcc.misc-tests/i386-pf-sse-1.c
--- GCC.orig/gcc/testsuite/gcc.misc-tests/i386-pf-sse-1.c	2002-01-15 17:30:28.000000000 +0000
+++ GCC/gcc/testsuite/gcc.misc-tests/i386-pf-sse-1.c	2004-08-01 20:43:35.000000000 +0000
@@ -3,6 +3,8 @@
 
 /* { dg-do compile { target i?86-*-* } } */
 
+extern void exit (int);
+
 char *msg = "howdy there";
 
 void foo (char *p)
diff -rupN GCC.orig/gcc/testsuite/objc.dg/nested-func-1.m GCC/gcc/testsuite/objc.dg/nested-func-1.m
--- GCC.orig/gcc/testsuite/objc.dg/nested-func-1.m	2003-09-25 01:26:01.000000000 +0000
+++ GCC/gcc/testsuite/objc.dg/nested-func-1.m	2004-08-02 19:08:58.000000000 +0000
@@ -4,6 +4,7 @@
 /* { dg-options "-lobjc" } */
 /* { dg-do run } */
 #include <stdio.h>
+#include <stdlib.h>
 #include <objc/objc.h>
 #include <objc/Object.h>
 
diff -rupN GCC.orig/gcc/testsuite/objc.dg/special/unclaimed-category-1.m GCC/gcc/testsuite/objc.dg/special/unclaimed-category-1.m
--- GCC.orig/gcc/testsuite/objc.dg/special/unclaimed-category-1.m	2003-10-04 07:36:53.000000000 +0000
+++ GCC/gcc/testsuite/objc.dg/special/unclaimed-category-1.m	2004-08-02 19:09:15.000000000 +0000
@@ -4,6 +4,8 @@
 #include <objc/objc-api.h>
 #include <objc/Object.h>
 
+extern void abort (void);
+
 /* Test loading unclaimed categories - categories of a class defined
    separately from the class itself.  */
 



More information about the Gcc-patches mailing list